For example, if an application program contains some functions specific to an operating system to perform some business logic, it might work properly in that particular operation system. Later if the same program is tried to run on different platform, it will fail. As a CICS application programmer, consider these issues while developing the application programs. Using the CICS APIs like EXEC CICS INQUIRE, get the operating system details and then validate and enclose such operating system specific functions calls for that operating system only.
As an example, the following API can be used to get the operating system details from application program.
EXEC CICS INQUIRE SYSTEM OPSYS(data-area)
CICS returns a one-byte character that represents the type of operating system on which the transaction is currently running. The following values are returned:
A represents CICS for AIX.
H represents CICS for HP-UX.
L represents CICS for Solaris.
N represents CICS for Windows.
Another example to know how the CICS application programs are invoked, as it can be invoked in different ways.
EXEC CICS INQUIRE TASK STARTCODE(data-area)
CICS returns upto a two-character value that indicates how this task started. Possible values are:
D The task was initiated to process a distributed programming link (DPL) command that did not specify the SYNCONRETURN option. (The task is not allowed to issue syncpoints.)
DS The task was initiated to process a distributed programming link (DPL) command that contains the SYNCONRETURN option. (The task is allowed to issue syncpoints.)
QD CICS initiated the task to process a transient data queue that had reached trigger level.
S Another task initiated this one, using a START command that did not pass data in the FROM option.
SD Another task initiated this one, using a START command that passed data in the FROM option.
TO The task was initiated to process unsolicited input from a terminal (or another system), and the transaction that is to be executed was determined from the input.
TP The task was initiated in response to a RETURN IMMEDIATE command in another task.
U CICS created the task internally.
The following example will provide way to get the process ID from the application program for logging purpose. Even though user can use directly getpid system call, but its syntax is different for different operating systems.
header file: unistd.h
Usage: printf("The process ID is %d.", getpid());
header file: process.h
Usage: printf("The process ID is %d.", _getpid());
Instead of using system call directly, application programmer can use the CICS provided API options to get such type of information.
EXEC CICS INQUIRE TASK PROCESSID(data-area)
CICS returns a 32-bit binary value that indicates the process ID of the process that is running the transaction that is associated with the task.
TXSeries for Multiplatforms provides lot of information about the environment under which the application is invoked or running with EXEC CICS INQUIRE SYSTEM and EXEC CICS INQUIRE TASK APIs.
For More information on the supported options for these APIs, please refer CICS API Command Reference.