Preinitializing the COBOL runtime environment
Using preinitialization, an application can initialize the COBOL runtime environment once, perform multiple executions using that environment, and then explicitly terminate the environment.
You can use preinitialization to invoke COBOL programs multiple times from a non-COBOL environment such as C/C++.
Preinitialization has two primary benefits:
- The COBOL environment stays ready for program calls.
Because a COBOL run unit is not terminated on return from the first COBOL program in the run unit, the COBOL programs that are invoked from a non-COBOL environment can be invoked in their last-used state.
- Performance is better.
Repeatedly creating and taking down the COBOL runtime environment involves overhead and can slow down an application.
Use preinitialization services for multilanguage applications in which non-COBOL programs need to use a COBOL program in its last-used state. For example, a file might be opened on the first call to a COBOL program, and the invoking program expects subsequent calls to the program to find the file open.
Use the interfaces described in the Related tasks to initialize and terminate a persistent COBOL runtime environment. Any shared library that contains a COBOL program used in a preinitialized environment cannot be deleted until the preinitialized environment is terminated.