Making dynamic calls to shared libraries under CICS

If you have a shared library that contains one or more COBOL programs, do not use it in more than one run unit within the same CICS transaction; otherwise the results are unpredictable.

The following figure shows a CICS transaction in which the same subprogram is called from two different run units:

This figure shows a subprogram called from two different run units.

Programs A and B share the same copy of Program C, and any changes to its state affect both programs.

In the CICS environment, programs in a shared library are initialized (whether by the WSCLEAR compiler option or by VALUE clause initialization) only on the first call within a run unit. If a COBOL subprogram is called more than once from either the same or different main programs, the subprogram is initialized on only the first call.

If you need the subprogram to be initialized on the first call from each main program, statically link a separate copy of the subprogram with each calling program. If you need the subprogram to be initialized on every call, use one of the following methods:

related tasks  
Using shared libraries  

related references  
WSCLEAR