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

Module 11: CICS Error Handling and Debugging


EIBRESP2

EIBRESP2 is the EIB's extended response code field. Just as RESP2 extends RESP, EIBRESP2 extends EIBRESP: after a command fails, it holds extra detail about why it failed. CICS fills it automatically after every command, so the detail is available even when RESP2 was not coded.

What is EIBRESP2

  • EIBRESP2 is defined as PIC S9(8) COMP in the EIB and is updated after every EXEC CICS command.
  • It is only meaningful when EIBRESP shows an error (not NORMAL). On success its value is not reliable.
  • The meaning of the value depends on which command failed. The same number means different things on a READ, a WRITEQ, or a SEND MAP.
  • To decode it, look up the failing command in the CICS Application Programming Reference or Messages and Codes manual.

EIBRESP2 and EIBRSRCE

  • EIBRSRCE is another EIB field, PIC X(8). It holds the name of the last resource used, for example the file or queue name.
  • Together, EIBRESP, EIBRESP2, and EIBRSRCE tell the full story: what failed, why in detail, and on which resource.
  • Error-logging routines should save all three. Support staff need the trio to diagnose a problem without rerunning it.
  • Like EIBRESP, EIBRESP2 is overwritten by the next CICS command, so save it immediately.

Example: logging full error detail

  • The example below captures the full error context right after a file update fails:
    WORKING-STORAGE SECTION. 01 ERR-RESP PIC S9(8) COMP. 01 ERR-RESP2 PIC S9(8) COMP. 01 ERR-RSRCE PIC X(8). COPY DFHRESP. PROCEDURE DIVISION. EXEC CICS REWRITE FILE('CUSTFILE') FROM(CUST-RECORD) END-EXEC. IF EIBRESP NOT = DFHRESP(NORMAL) MOVE EIBRESP TO ERR-RESP MOVE EIBRESP2 TO ERR-RESP2 MOVE EIBRSRCE TO ERR-RSRCE PERFORM 9000-WRITE-ERROR-LOG END-IF.

EIBRESP2 good practices

  • Always log EIBRESP2 together with EIBRESP. Logging one without the other leaves the diagnosis half done.
  • Never branch on a hard-coded EIBRESP2 number without a comment naming the command it belongs to.
  • When raising a problem with systems support, quote the command, EIBRESP condition name, EIBRESP2 value, and EIBRSRCE together.





© copyright mainframebug.com
Privacy Policy
MainframeBug Assistant