Handle conditions.
HANDLE CONDITION .------------------------. V | >>-HANDLE CONDITION----condition--+---------+-+---------------->< '-(label)-'
This command is threadsafe.
You use HANDLE CONDITION to specify the label to which control is to be passed if a condition occurs. You must include the name of the condition and, optionally, a label to which control is to be passed if the condition occurs.
If you omit “label”, any HANDLE CONDITION command for the condition is deactivated, and the default action is taken if the condition occurs. This is independent of the setting of the generalized ERROR condition.
You must ensure that the HANDLE CONDITION command is executed before the command that may give rise to the associated condition.
You cannot include more than sixteen conditions in the same command; the conditions should be separated by at least one space. You must specify additional conditions in further HANDLE CONDITION commands.
If a condition occurs that is not specified in a HANDLE CONDITION or IGNORE CONDITION command, the default action is taken. If, however, the default action for a condition not specified in a HANDLE CONDITION or IGNORE CONDITION command terminates the task abnormally, and the condition ERROR has been specified, the action for ERROR is taken.
The execution key that the label receives control in, is the execution key that the program was running in when the HANDLE CONDITION command was issued.
In an assembler language application program, when a branch to a
label is caused by a condition, the registers in the application program are
restored to their values in the program at the point where the command that
caused the condition is issued.
In a PL/I application program, a branch to a label in an inactive procedure or in an inactive begin block, caused by a condition, produces unpredictable results.
The C language does not support HANDLE CONDITION.
For more information about the conditions, see EXEC interface block.
The following example shows you how to handle conditions, such as DUPREC, LENGERR, and so on, that can occur when you use a WRITE command to add a record to a data set.
EXEC CICS HANDLE CONDITION
ERROR(ERRHANDL)
DUPREC(DUPRTN) LENGERR