IGNORE CONDITION
The CICS IGNORE CONDITION statement is used to disable the default error handling for a specific condition within a program. When a condition occurs, instead of invoking an error-handling routine or causing an abend, CICS ignores the error and continues execution. This command overrides the same conditions coded in "HANDLE CONDITION" command, and specifying that the conditions should be ignored. If a condition is coded in both "HANDLE CONDITION" and "IGNORE CONDITION," the latest will take precedence and override the old one.
Users can include up to 16 conditions in a single "IGNORE CONDITION" commands.
Why?
- To prevent unnecessary program interruptions when a condition is expected.
- To override previously set HANDLE CONDITION statements.
Key Features -
- Disables the automatic handling of specific conditions.
- Prevents CICS from invoking the default error-handling routine.
- Overrides HANDLE CONDITION for the specified condition.
- Allows normal execution to continue even if the condition occurs.
Syntax -
EXEC CICS IGNORE CONDITION
ERROR-CODE
[ERROR-CODE2 ...]
END-EXEC.
- ERROR-CODE - Specifies the CICS condition to be ignored (e.g., NOTFND, DUPKEY). Common Error Codes -
- NOTFND - Record not found in a VSAM file or DB2 table.
- INVREQ - Invalid request made to CICS.
- ILLOGIC - Logical error detected in VSAM file operations.
- ITEMERR - Item requested in a queue or storage area does not exist.
- DUPKEY - A duplicate key was found while inserting a record.
- QIDERR - An invalid queue ID was used in a TS or TD queue.
- ERROR-CODE2 - Multiple error conditions can be ignored within a single statement.
Short Examples -
Scenario1 - Ignoring Record Not Found (NOTFND)
...
PROCEDURE DIVISION.
...
EXEC CICS IGNORE CONDITION
NOTFND
END-EXEC.
EXEC CICS READ
DATASET('CUSTFILE')
INTO(WS-DATA)
RESP(WS-RESP)
END-EXEC.
IF WS-RESP NOT = 0 THEN
...
END-IF.
In this case, if the record is not found (NOTFND), CICS does not terminate or invoke an error handler. Execution continues without interruption.
Scenario2 - Ignoring Multiple Conditions
...
PROCEDURE DIVISION.
EXEC CICS IGNORE CONDITION
NOTFND
DUPKEY
END-EXEC.
EXEC CICS WRITE
DATASET('CUSTFILE')
FROM(WS-RECORD)
RESP(WS-RESP)
END-EXEC.
IF WS-RESP NOT = 0 THEN
...
END-IF.
If a duplicate key (DUPKEY) or a missing record (NOTFND) occurs, CICS ignores the error and continues execution.