Execute Interface Block (EIB) is a CICS area that contains information related to the current task. I’ll explain how to use some of the other fields. For a complete explanation of these fields and their possible values, you can refer to the IBM manual CICS Application Programming Reference.

EIBDATE and EIBTIME contain the date and time your task was started. EIBDATE indicates what number day in the year it is and includes an identifier for the century. So December 31, 1999 is stored as 0099365 (the 365th day of 1999), and January 12, 2001 is stored as 0101012. EIBTIME reflects a 24-hour clock (where 2:00 p.m. is hour 14, for example). So midnight is stored as 0000000; one second before midnight is 0235959.

Although the date format is useful for date comparisons, it’s inappropriate for display purposes. And two time values can only be compared if you’re confident that both represent the same day. As a result, you’ll often use the CICS FORMATTIME command to convert times and dates to and from various formats. You’ll learn how to use the FORMATTIME command later in this chapter.

Several of the Execute Interface Block fields are particularly useful when debugging a CICS program. In fact, you saw four of them used in the SYSERR program: EIBRESP, EIBRESP2, EIBRSRCE, and EIBTRNID. You might also use EIBRCODE to get the CICS response code, or EIBFN to determine the last CICS command that was executed.

EIBTRNID is often used for purposes other than debugging, too. It contains the trans-id that started the current task, so one of its common uses is to determine how a program was started. For example, you might check this field to insure that a program is invoked only from a menu, not by entering the program’s trans-id at a terminal. In that case, this field should contain the trans-id of the menu program.

How to access CICS storage areas other than working storage?

The Execute Interface Block (EIB):  is a CICS area that contains information related to the current task, such as the date and time the task was started and the transaction-id that was used to start it.

The definition of the EIB is automatically inserted into the Linkage Section of the program when the program is prepared for execution. You don’t have to code it yourself.

When the user presses an attention identifer (AID) key, CICS passes a one-byte value to the program through the EIBAID field in the Execute Interface Block. You can use the value of this field to determine the processing the user has requested.

The EIBCALEN field contains the length of the data passed to the program through its communication area (DFHCOMMAREA). A length of zero indicates that no data was passed to the program. In a pseudo-conversational program, that means that it’s the first execution of the program

Other CICS System areas?

The Common System Area (CSA) is a major CICS control block that contains important system information, including pointers to most of the other CICS control blocks. Access to the information in the CSA is provided through the ASSIGN command.

The Common Work Area (CWA) is a storage area that can be accessed by any task in a CICS system. Its format is installation-dependent. It often contains information such as the company name, the current date already converted to the form MM/DD/YYYY, or other application-specific information.

The Terminal Control Table User Area (TCTUA) is a user-defined storage area that’s unique to the terminal where the current task is attached, and it’s maintained even when no task is attached to the terminal. So you may want to keep terminal-related information there.

The Transaction Work Area (TWA) is a storage area that’s unique to the current task, so you may want to use it to store information about the execution of a transaction. It’s deleted when the task ends.

To access the CWA, TCTUA, or TWA in the Linkage Section, you use the ADDRESS command to establish addressability

Code to handle un-recoverable errors in CICS

C *
C     05 ERR-RESP PIC S9(8) COMP.
C     05 ERR-RESP2 PIC S9(8) COMP.
C     05 ERR-TRNID PIC X(4).
C     05 ERR-RSRCE PIC X(8).