Example of Using a Managed COBOL Wrapper Class

The following example illustrates how you can expose a procedural program to managed applications by wrapping the program in a managed COBOL wrapper class first. You then let other managed applications talk to the wrapper class using Object-Oriented (OO) syntax. The wrapper class, in its turn, talks to the procedural program.

There are different ways to write wrapper classes and this example two of them.

You are going to use a simple procedural COBOL program, a calculator, which performs the basic arithmetic operations. You will use Visual COBOL to create a managed project to hold the code of the procedural program and a managed COBOL wrapper class for the procedural code. You will also create a project for a managed COBOL front-end application that will communicate with the procedural module using the wrapper class.