When a CICS transaction fails or abends, problem determination is the process of finding out why. You use response codes (EIBRESP, EIBRESP2), error handling in your program (HANDLE CONDITION, NOHANDLE), dumps (transaction and system), and trace data to locate the cause. This page explains how to handle command responses, avoid unnecessary abends, and use dumps and trace to diagnose failures.
When something goes wrong in CICS, problem determination is like being a detective. You look at the clues: Did the program get an error code from CICS (EIBRESP)? Did the task dump? What did the trace show? By handling errors in code (so the program does not crash when something expected happens) and by using dumps and trace when something unexpected happens, you can find out what failed and fix it.
After every EXEC CICS command, CICS sets EIBRESP (and often EIBRESP2) in the EIB. EIBRESP is a numeric or symbolic code: DFHRESP(NORMAL) (or the equivalent numeric value) means success. Other values indicate a condition such as NOTFND (resource or record not found), DUPREC (duplicate key), INVREQ (invalid request), LENGERR (length error), or NOSPACE. EIBRESP2 can hold a subcode or additional detail. Your program should check these after commands that can fail, unless you use HANDLE CONDITION to transfer control to an error paragraph. If you do not handle the condition and the response is not normal, CICS may abend the task.
| Condition | Meaning | Typical action |
|---|---|---|
| NORMAL | Command completed successfully | Continue |
| NOTFND | Resource or record not found | Check key, resource name, or existence |
| DUPREC | Duplicate key (e.g. WRITE with existing key) | Handle duplicate; update or reject |
| INVREQ | Invalid request (wrong state or parameter) | Check command sequence and parameters |
| LENGERR | Length error (e.g. buffer too small) | Check LENGTH and buffer sizes |
| NOSPACE | No space (e.g. queue or storage) | Retry or free resources |
1234567891011121314EXEC CICS READ FILE('CUSTFILE') RIDFLD(WS-KEY) INTO(WS-RECORD) NOHANDLE END-EXEC IF EIBRESP NOT = DFHRESP(NORMAL) IF EIBRESP = DFHRESP(NOTFND) PERFORM RECORD-NOT-FOUND ELSE PERFORM LOG-AND-ABEND END-IF END-IF
HANDLE CONDITION lets you declare what to do when a specific condition occurs. You name the condition (e.g. NOTFND, DUPREC) and a paragraph or section to branch to. When that condition happens on a subsequent EXEC CICS command, CICS transfers control to that paragraph instead of abending. You can have multiple HANDLE CONDITIONs for different conditions. RESP and RESP2 options on the command let you store the response in working-storage variables instead of (or in addition to) using the EIB. NOHANDLE on a command means "do not automatically handle any condition for this command"; the program must check EIBRESP (or RESP/RESP2) and branch itself. Use NOHANDLE when you want in-line checks after every command. Use HANDLE CONDITION when you prefer a single error paragraph for a set of commands.
123456789101112*> Branch to paragraph on condition EXEC CICS HANDLE CONDITION NOTFND(NOT-FOUND-PARA) DUPREC(DUPLICATE-PARA) END-EXEC EXEC CICS READ FILE('X') RIDFLD(WS-KEY) INTO(WS-REC) END-EXEC *> If NOTFND, control goes to NOT-FOUND-PARA ... NOT-FOUND-PARA. MOVE 'NOT FOUND' TO WS-MESSAGE EXEC CICS RETURN END-EXEC.
When a task ends abnormally, CICS produces an abend. The abend code (e.g. in the dump or in monitoring) identifies the type of failure. Some abends are application-related (e.g. bad data, unhandled condition); others are system or resource-related. Dump codes control whether CICS takes a dump and what type (transaction vs system) and what action to take (e.g. shutdown, propagate in a sysplex). Understanding the abend code and the dump (if present) helps you see where the program was and what state the task was in when it failed.
A CICS transaction dump captures information for the failing task: trace entries, control blocks, and task-related storage. It is the right choice for debugging application and transaction abends. You can request a transaction dump when a task is suspended or suspected of looping. A CICS system dump captures the entire CICS address space (and possibly more). It is used for system-level problems and is often requested by IBM Support. For most application issues, the transaction dump and the program's error handling (EIBRESP, HANDLE CONDITION) are what you need first.
CICS trace (e.g. AUXTRACE) records execution flow and component activity. When formatted (e.g. with the EYU9XZUT or equivalent utility), it shows the sequence of CICS commands and events. That helps you see exactly which command was running when the failure occurred and what happened before it. Trace data is one of the key artifacts for problem determination; keep it when investigating an abend and consider enabling it for the transaction or region if you need to reproduce an issue.
1. To prevent CICS from abending when a command fails, you should:
2. EIBRESP is set:
3. A CICS transaction dump is used to: