Initializing environments

To make a call between C/C++ and COBOL, you must properly initialize the target environment.

About this task

If your main program is written in C/C++ and makes multiple calls to a COBOL program, use one of the following approaches:

  • Preinitialize the COBOL environment in the C/C++ program before it calls any COBOL program. This approach is recommended because it provides the best performance.
  • Put the COBOL program in an executable that is not part of the C/C++ routine that calls COBOL. Then every time that you want to call the main COBOL program, do the following steps in the C/C++ program:
    1. Load the program.
    2. Call the program.
    3. Unload the program.