A software application, as legacy as it is, must be able to evolve in a modern environment, like the .NET framework; the unavoidable new developments must be able to interact somehow with the legacy programs, the easier the better.
The .NET framework and the Raincode stack allow to do this and makes it (almost) trivial to call a COBOL program from C#, and vice-versa, as well as passing correctly typed data between the COBOL and C# worlds. This allows the two worlds to work independently, without knowing that the other exist, and still be allowed to interact when needed.
The following video is a tutorial explaining in detail how to write a C# program callable from PL/I (this also applies to COBOL).
The main idea is to simply export the class to make it visible to the Raincode runtime. It also shows how to use the compiler to generate “helper structures”: C# data structure acting as the data-bridge between C# and COBOL. The helper structures make it possible for C# to seamlessly handle data coming from COBOL, and pass data back.