Exit programs and the CICS storage protection facility

When you are running CICS® with the storage protection facility, this affects the execution key in which your user exit programs run and the storage key of data storage that your exit programs obtains.

Execution key for global user exit programs

When you are running with storage protection active, CICS always invokes global user exit programs in CICS key. Even if you specify EXECKEY(USER) on the program resource definition, CICS forces CICS key when it passes control to the exit program. However, if a global user exit program itself passes control to another program (via a link or transfer-control command), the program thus invoked is executed according to the execution key (EXECKEY) defined in its program resource definition.

You are strongly recommended to specify EXECKEY(CICS) when defining both global user exit programs and programs to which an exit program passes control.

Data storage key for global user exit programs

The storage key of storage used by global user exit programs depends on how the storage is obtained:

  • The CICS-supplied storage addressed by the UEPXSTOR parameter of DFHUEPAR, and any global work area specified when an exit program is enabled, are always in CICS key.
  • Global user exit programs that can issue EXEC CICS commands can obtain storage by:
    • Explicit EXEC CICS GETMAIN commands
    • Implicit storage requests as a result of EXEC CICS commands that use the SET option.

    The default storage key for storage obtained by EXEC CICS commands is set by the TASKDATAKEY of the transaction under which the exit program is invoked.

    As an example, consider a transaction defined with TASKDATAKEY(USER) that issues a file control request, which causes an XFCREQ global user exit program to be invoked. In this case, any implicit or explicit storage acquired by the exit program by means of an EXEC CICS command is, by default, in user-key storage. However, on an EXEC CICS GETMAIN command, the exit program can override the TASKDATAKEY option by specifying either CICSDATAKEY or USERDATAKEY.

  • When an exit program obtains storage using an XPI GETMAIN call, the storage key depends on the value specified on the STORAGE_CLASS option, which is mandatory, and which overrides the value of TASKDATAKEY.

Exit programs and transaction isolation

When you are running CICS with the transaction isolation facility (TRANISO=YES), the exit program will inherit the subspace of the application that caused the exit to be invoked.

If your GLUE needs to access storage belonging to a task other than the invoking task, it should use the DFHSMSRX SWITCH_SUBSPACE XPI command to switch to base space. It does not need to switch back to subspace mode before returning to CICS as CICS will restore the subspace mode if necessary.