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

Module 11: CICS Error Handling and Debugging


EIBRESP

EIBRESP is a field in the Execute Interface Block (EIB) that CICS updates after every EXEC CICS command. It holds the response code of the last command: zero means NORMAL, anything else names the condition that was raised. Because CICS fills it automatically, you can check the outcome of a command even when you did not code RESP.

What is EIBRESP

  • EIBRESP is defined as PIC S9(8) COMP in the EIB, which CICS provides automatically. You do not define it yourself.
  • After every EXEC CICS command, EIBRESP holds the response code for that command, exactly as if you had coded RESP.
  • Compare it with DFHRESP values from the COPY DFHRESP copybook: IF EIBRESP = DFHRESP(NOTFND).
  • The EIB is available in every CICS program without any extra coding, so EIBRESP is always there to check.

RESP vs EIBRESP

  • RESP is your own variable, coded per command. EIBRESP is CICS's field, updated after every command.
  • If RESP is coded on a command, both your variable and EIBRESP get the same value.
  • EIBRESP is overwritten by the very next CICS command. Save it to working storage immediately if you need it later.
  • Many shops code RESP for clarity even though EIBRESP exists, because the RESP variable documents the intent right on the command.

Example: testing EIBRESP after a write

  • The example below writes a record and checks EIBRESP directly, with no RESP coded:
    WORKING-STORAGE SECTION. 01 WS-SAVE-RESP PIC S9(8) COMP. COPY DFHRESP. PROCEDURE DIVISION. EXEC CICS WRITE FILE('CUSTFILE') FROM(CUST-RECORD) RIDFLD(CUST-ID) END-EXEC. MOVE EIBRESP TO WS-SAVE-RESP. EVALUATE WS-SAVE-RESP WHEN DFHRESP(NORMAL) MOVE 'RECORD ADDED' TO MSG-LINE WHEN DFHRESP(DUPREC) MOVE 'CUSTOMER ALREADY EXISTS' TO MSG-LINE WHEN OTHER MOVE 'WRITE FAILED' TO MSG-LINE END-EVALUATE.

EIBRESP good practices

  • Test EIBRESP immediately after the command. Even a SEND TEXT for a message in between would overwrite it.
  • In error-logging routines, move EIBRESP to a working-storage field first, then log the saved value.
  • Remember that EIBRESP reflects the last command only. It tells you nothing about earlier commands in the paragraph.





© copyright mainframebug.com
Privacy Policy
MainframeBug Assistant