TSO-ISPF JCL COBOL VSAM DB2 CICS Tools Articles Job Portal Forum Quiz Interview Q&A

CICS ABEND Command


USER-ABEND:

In batch COBOL, the user ABENDS can be thrown by calling the assembler routine ILBOABN0 using AB-CODE whereas AB-CODE is working storage field of half word binary.

The following command is used to throw user ABENDS in CICS.

Syntax:

EXEC CICS ABEND ABCODE(‘9999’) 

The above CICS command is used to throw user ABEND 9999.


Example:

WORKING-STORAGE SECTION.
77 MSG-LEN           PIC S9(4) COMP.
01 MSG-DATA.
 05 MSG-DATA1      PIC X(15).
 05 MSG-DATA2      PIC X(50).
:
PROCEDURE DIVISION.
    :
    EXEC CICS HANDLE ABEND
                LABEL(ABEND-ROUTINE)
    END-EXEC.
    :
    ABEND-ROUTINE.
    MOVE ‘ABEND OCCURED.’ TO MSG-DATA1.
    MOVE ‘TASK CANCELLED WITH ABCODE 9999.’ TO MSG-DATA2.
    MOVE  65 TO MSG-LEN.
    EXEC CICS SEND
                FROM (MSG-DATA)
                LENGTH(MSG-LEN)
                NOHANDLE
    END-EXEC.
    EXEC CICS HANDLE ABEND
               CANCEL
    END-EXEC.
    EXEC CICS ABEND
                ABCODE(‘9999’)
    END-EXEC.

HANDLE CONDITION and IGNORE CONDITION commands remain in effect until program ends.


If you have any doubts or queries related to this chapter, get them clarified from our Mainframe experts on ibmmainframer Community!

Are you looking for Job Change? Job Portal