iscics() — Verify whether CICS is running

Standards

Standards / Extensions C or C++ Dependencies
Language Environment both  

Format

#include <cics.h>

int iscics(void);

General description

Determines whether the program is running under CICS®.

Returned value

If your program is currently running under CICS, iscics() returns nonzero.

If not running under CICS, iscics() returns 0.

Example

CELEBI04
⁄* CELEBI04

   This example tests to see if the program is running under CICS.
   If not, it calls a subroutine ABCPGM; otherwise, it uses a CICS EXEC
   statement to invoke ABCPGM.

 *⁄
#define _POSIX_SOURCE
#ifdef __cplusplus
  extern "OS" void ABCPGM(char *);
#else
  #pragma linkage(ABCPGM, OS)
  void ABCPGM(char *);
#endif

#include <stdio.h>
#include <cics.h>
#include <string.h>
#include <sys⁄wait.h>
#include <sys⁄types.h>
#include <unistd.h>

int main(void)
{
 char mydata[123];

 if (iscics() == 0)
    {
     ⁄* not a CICS environment *⁄
     ABCPGM(mydata);
    }

 else {
       ⁄* this is a CICS environment *⁄
       EXEC CICS, LINK PROGRAM,("ABCPGM  "), COMMAREA(mydata);
      }
}

Related information