Testing for CICS
A program has two ways to determine whether it is running in a CICS® environment: by using the C language iscics() function or by calling the DFH3QSS program.
About this task
- iscics
- If you are adapting an existing C language program or writing a new program that is designed to run outside CICS as well as under CICS, the C language iscics() function can prove useful. It returns a non-zero value if your program is currently running under CICS, or zero otherwise. This function is an extension to the C library.
- DFH3QSS
- Your program can call the DFH3QSS program to query the CICS environment and API capability. Link DFH3QSS statically
into your own application. On return, register 15 addresses a result
structure that consists of a halfword length (that includes itself)
followed by a reserved halfword (currently zero) followed by a bit
string:
- Bit 0
- When set to 1, this means that the caller is running in a CICS environment (on a CICS-managed TCB or one of its descendants).
- Bit 1
- When set to 1, this means that the CICS API is available to the caller (in the current PSW key, ASC-mode, AMODE, and cross-memory environment).
The output structure remains accessible as long as the TCB under which the request was issued has not terminated and DFH3QSS itself is still present in virtual storage. Any change of execution state (such as PSW key, ASC-mode, AMODE, or cross-memory environment) might affect the availability of the CICS API. Registers are preserved.
- Environment
- This function must be called in problem state.