Retaining the C environment using preinitialization

If an assembler routine called the same C or C++ program repeatedly, the creation and termination of the C/C++ environment for each call would be inefficient. The solution is to create the C/C++ environment only once by preinitializing the C or C++ program. The Language Environment® preinitialization (CEEPIPI) services are the strategic form of preinitialization. For information on the Language Environment preinitialization (CEEPIPI) services, see z/OS Language Environment Programming Guide. This section discusses the z/OS® XL C preinitialization interface only for reasons of compatibility.
Notes:
  1. This information pertains only to users of C programs.
  2. XPLINK applications are not supported under Preinitialized Compatibility Interface (PICI) environments.
  3. POSIX(ON) is not supported under PICI environments.
  4. AMODE 64 applications are not supported under PICI environments.

If you are calling a C program multiple times from an assembler program, you can establish the C environment and then repeatedly invoke the C program using the already established C environment. You incur the overhead of initializing and terminating the C environment only once instead of every time you invoke the C program.

Because C detects programs that can be preinitialized dynamically during initialization, you do not have to recompile the program or link-edit it again.

To maintain the C environment, you start the program with the C entry CEESTART, and pass a special Extended Parameter List that indicates that the program is to be preinitialized.

When you use preinitialization, you are initializing the library yourself with the INIT call and terminating it yourself with the TERM call. In a non-preinitialized program, the library closes any files you left open and releases storage. It does not do this in a preinitialized program. Therefore, for every invocation of your preinitialized program, you must release all allocated resources as follows:
  • Close all files that were opened
  • Free all allocated storage
  • Release all fetched modules
If you do not release all allocated resources, you will waste memory.