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

CICS HANDLE Condition


To pass control to a specified label. Although the use of the RESP option is recommended in handling program conditions, CICS HANDLE CONDITION command is another method of handling various anticipated or unexpected CICS conditions.

Every CICS command has its own exception list. One example is MAPFAIL exception of RECEIVE command. HANDLE CONDITION is used to transfer control to the proper procedure on expected exceptions. HANDLE condition cannot track program interrupted ABENDS like S0C4 or S0C7. It deals only with exceptions of CICS commands.

The conditions handled are effective from where it appears to the end of the program. One Handle Condition can be overridden by another condition. The main program conditions will not be effective in sub-programs.

Syntax:

EXEC CICS HANDLE CONDITION
    ERROR(ERROR-MESSAGE)
END-EXEC

The HANDLE Condition command is executed prior to the condition being encountered, whereas the results of the results of the RESP option are tested after execution of a CICS command.


HANDLE CONDITION - SCOPE

Handle condition remains active,

  • Until an IGNORE Condition

  • Another HANDLE CONDITION for the same error

  • Deactivated by NOHANDLE Option in commands

If you want to reset the diversion done by previous HANDLE condition, code the condition name but don’t mention the paragraph name. Maximum 12 conditions can be coded in one HANDLE CONDITION statement.


Example:

EXEC CICS HANDLE CONDITION
	MAPFAIL(PARA-1)
	PGMIDERR(PARA-2)
	LENGERR(PARA-3)
	ERROR(PARA-X)
END-EXEC.

Description:

If MAPFAIL then execute the PARA-1, If PGMIDERR then execute the PARA-2, If LENGERR then execute the PARA-3.

Any error condition other than MAPFAIL,PGMIDERR and LENGERR will transfer the control to PARA-X.


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