Best ways to handle unrecoverable errors in CICS programs

Tips for Debugging CICS programMethod-1 Best one method is to call an error program, by passing error parameters.

WORKING-STORAGE SECTION.
 *
 COPY ERRPARM.
C 01 ERROR-PARAMETERS.
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).
 .
 .
 PROCEDURE DIVISION.
 .
 .
 IF RESPONSE-CODE NOT = DFHRESP(NORMAL)
 PERFORM 9999-TERMINATE-PROGRAM.
 .
 .
 9999-TERMINATE-PROGRAM.
 *
 MOVE EIBRESP TO ERR-RESP.
 MOVE EIBRESP2 TO ERR-RESP2.
 MOVE EIBTRNID TO ERR-TRNID.
 MOVE EIBRSRCE TO ERR-RSRCE.
 EXEC CICS 
    XCTL PROGRAM('SYSERR') 
    COMMAREA(ERROR-PARAMETERS)
 END-EXEC.

CICS Tough Interview questions part 1 of 3

What is error program

  • An error handling program usually displays an error message to the user and does extensive processing, including writing detailed error information to an error log, reversing any changes that were made to recoverable files, and producing a storage dump.
  • It may also cause the program to abend, or it may just end with a RETURN command.
  • Any program that branches to the error handling program will probably be required to pass along information on its current status, including information that’s available in the Execute Interface Block.

Method-2 Sending error message to user through CICS screen. This error message we can write in main program.

 EXEC CICS
       SEND TEXT FROM(ERROR-MESSAGE)
       ERASE
       ALARM
       FREEKB
 END-EXEC.
Advertisements