To enable the calling of PL/I subroutines from another language, you must first initialize the PL/I run-time system (RTS), and then terminate it after the subroutine is executed. You can use either static or dynamic calls.
To drive PL/I application logic in a subroutine, use the PL/I API to initialize and then terminate the PL/I RTS exactly one time each using:
You can implement the required initialization and termination in various ways depending on your programming needs. The following list provides some possibilities:
Compile your main COBOL program with the -initcall directive. In the named initcall routine:
The following applies to both routines:
In all cases, put some thought into the overall design of your PL/I subroutines and how they are used in your program(s). Ensure that the PL/I RTS is not terminated until you are done doing PL/I work. We recommend that you initialize the PL/I RTS by first calling a single routine, and let the tear down of the COBOL environment terminate the RTS and de-initialize the environment.
* The one exception to this method applies when calling a PL/I subroutine from multiple CICS link levels. In this case, you
need to manage exactly one initialization and one termination per link level using the API
__lpi_get_kix_level() call to determine the current link level and to determine whether to instantiate or tear down a given PL/I RTS context. Each
subsequent call to
__lpi_init() creates a new stacked RTS context, and
__lpi_fini_and_return() removes the current context. For example:
int __lpi_get_kix_level(); CAUTION:
As this is an advanced procedure, do not attempt it unless you are confidant in your understanding of CICS link levels and
PL/I API concepts.
|
PL/I routines can be called statically or dynamically linked. When dynamically linked/called, be sure to consider the design recommendations put forth in the RTS Initialization and Termination section above.