Let's understand Mainframe
Home Tutorials Interview Q&A Quiz Mainframe Memes Contact us About us

Module 4: CICS COBOL Programming


DFHEIBLK

DFHEIBLK is the Execute Interface Block. It is the control block through which CICS passes information about the current task to your program. In COBOL you know it as the EIB.

What DFHEIBLK is

  • CICS builds one EIB for every task and passes its address to your program at entry.
  • The translator generates the EIB layout and inserts the DFHEIBLK definition into your Linkage Section automatically.
  • You never code the EIB layout yourself. You simply reference its field names, like EIBTRNID or EIBCALEN.
  • The fields are read-only inputs from CICS, except EIBRCODE which some commands update.

Fields you will use most

  • EIBTRNID - the 4-character transaction id that started this task.
  • EIBTRMID - the 4-character terminal id the task is running on.
  • EIBCALEN - length of the DFHCOMMAREA passed to this program. Zero means no commarea was passed.
  • EIBAID - the attention key the user pressed (compare with DFHAID copybook values like DFHPF3, DFHENTER).
  • EIBDATE and EIBTIME - the current date and time in packed format.
  • EIBRESP and EIBRESP2 - response codes from the last CICS command.
  • EIBCPOSN - the cursor position on the screen after a RECEIVE MAP.

Reading the EIB in COBOL

  • Copy DFHAID into Working-Storage to get the attention-key values (DFHENTER, DFHPF1 ... DFHPF24).
  • Test EIBCALEN = ZERO to detect the first call of a pseudo-conversational program.
  • Test EIBAID to find which PF key or ENTER the user pressed.
WORKING-STORAGE SECTION.
COPY DFHAID.
LINKAGE SECTION.
01  DFHCOMMAREA                 PIC X(100).
PROCEDURE DIVISION.
IF EIBCALEN = ZERO
       * First time this program is called: initialize
       MOVE LOW-VALUES TO WS-WORK-FIELDS
END-IF.
IF EIBAID = DFHPF3
       * User pressed PF3: end the task
       EXEC CICS RETURN
       END-EXEC
END-IF.
  • Note: the translator inserts the DFHEIBLK definition itself, so you only declare DFHCOMMAREA in the Linkage Section.





© copyright mainframebug.com
Privacy Policy
MainframeBug Assistant