Mainframe Error Codes
JCL · COBOL · DB2 · CICS — Interview Reference
1. JCL — Errors & Fixes
Condition Codes
Code Meaning
0 Success
4 Warning
8 Error
12 Severe error
16 Terminal failure
System Abend Codes
Abend Cause Fix
S013 DCB mismatch (LRECL/BLKSIZE/RECFM) Match DCB params in JCL with actual dataset
S022 Region/CPU limit exceeded Increase REGION= on JOB/EXEC card
S037 Dataset out of space Increase SPACE= primary/secondary allocation
S122 Time limit hit Increase TIME= on JOB card
S222 Cancelled by operator Check job log for reason; resubmit
S322 CPU time exceeded Optimize code or increase TIME=
S806 Load module not found Check STEPLIB/JOBLIB points to correct LOADLIB
S878 Virtual storage shortage Increase REGION=, reduce working storage
S913 RACF access denied Request access from security admin
SD37 No secondary extents left Increase secondary space or delete old datasets
SE37 Max 16 extents reached Re-allocate with larger primary space
2. COBOL — File Status Codes & Fixes
Status Cause Fix
00 Success No action needed
02 Duplicate alternate key Handle in code — expected for KSDS
10 End of file Code AT END clause properly
22 Duplicate primary key Check if record exists before WRITE
23 Record not found Validate key; code INVALID KEY handler
24 Disk full Increase dataset space allocation
30 Permanent I/O error Check dataset integrity; contact sysadmin
Status Cause Fix
35 File not found at OPEN Verify DD name in JCL matches SELECT
39 DCB mismatch Match LRECL/RECFM in FD with JCL DCB
41 File already open Remove duplicate OPEN or add check
43 REWRITE without prior READ Always READ before REWRITE
46 READ past EOF Check AT END logic; don't READ after EOF flag
51 Record locked Handle in code; retry or use NOSUSPEND
96 No DD statement Add missing DD card in JCL for that file
Runtime Abends
Abend Cause Fix
S0C1 Invalid instruction / bad branch Check for uninitialized pointers or CALL targets
S0C4 Bad memory access Check subscript bounds; array overflow
S0C7 ★ Invalid COMP-3 data — most common Initialize all numeric fields; validate input data
S0C9 Divide by zero Add IF DIVISOR = 0 check before divide
S806 Program not found Verify STEPLIB/LOADLIB has compiled load module
3. DB2 — Key SQLCODEs & Fixes
Positive (Warnings)
SQLCODE Cause Fix
+000 Success No action
+100 Row not found / cursor exhausted Always check SQLCODE = +100 after SELECT/FETCH
+445 Value truncated Increase host variable size or trim input
Negative (Errors)
SQLCODE Cause Fix
-104 Syntax error in SQL Review SQL for missing comma or keyword
-204 Table/view not found Check table name spelling and schema/qualifier
-206 Column not in table/scope Verify column name exists in that table
-302 Input value too large Trim input or increase column length
-305 NULL into host var without indicator Add null indicator variable in COBOL
-313 Wrong number of host variables Count :HV vars — must match ? in SQL
-407 NULL into NOT NULL column Provide a value; check source data
-501 FETCH on closed cursor Ensure OPEN cursor before FETCH
-502 OPEN on already open cursor Add CLOSE cursor before reopening
-530 Foreign key — parent row not found Insert parent row first before child
-803 Duplicate key on INSERT Check if row exists first using SELECT
SQLCODE Cause Fix
-805 Package not found in plan Rebind: BIND PACKAGE(...)
-811 ★ Subquery returns multiple rows Use cursor with FETCH instead of SELECT INTO
-818 Timestamp mismatch Recompile and rebind the program
-904 Resource unavailable / locked Retry later or check DB2 locks
-911 Deadlock — rollback done Code retry logic; increase commit frequency
-913 Timeout / deadlock Increase timeout or restructure transaction
-551 No execute privilege GRANT EXECUTE ON PLAN TO user
4. CICS — Response Codes & Fixes
EIBRESP Conditions
RESP Condition Cause Fix
0 NORMAL Success No action
11 MAPFAIL No data entered on screen Handle RESP=MAPFAIL; re-send map
16 NOTFND VSAM record not found Code WHEN NOTFND in HANDLE CONDITION
17 DUPREC Duplicate record on WRITE Check before WRITE; use REWRITE if updating
19 INVREQ Invalid CICS command usage Check command syntax and file attributes
20 IOERR VSAM I/O error Check file definition and dataset integrity
22 NOTOPEN File not open in CICS CEMT SET FILE(xx) OPEN
25 LENGERR Length mismatch Match LENGTH in CICS command with record size
27 QZERO TSQ/TDQ queue empty Check queue exists before reading
36 PGMIDERR Program not found Check PPT; ensure load module in LOADLIB
44 TRANSIDERR Transaction not defined Define transaction in PCT / CEDA
110 ITEMERR TSQ item number invalid Validate item number before READQ TS
CICS Abend Codes
Abend Cause Fix
ASRA ★ Program check (S0Cx equivalent) Analyze CICS dump; fix S0C7/S0C4 in COBOL
AICA Infinite loop — runaway task Add loop counters; ensure EXEC CICS RETURN exists
ASP3 Stale program in cache CEMT SET PROG(xx) NEWCOPY
APCT Program not found Verify PPT entry + load module in LOADLIB
AEY9 DB2 unavailable Check DB2 is started; verify RCT entry
AFCA File control error Check FCT/file definition in CEDA
ATNI Terminal not connected Check terminal definition and network
Top Interview Points
• S0C7 → #1 COBOL abend — always caused by uninitialized or bad COMP-3 data
• -811 → use a cursor instead of SELECT INTO when multiple rows possible
• -818 → recompile + rebind every time source changes
• ASRA in CICS → same root cause as S0Cx; need CICS dump to diagnose
• ASP3 → fixed by NEWCOPY; happens after program recompile without refresh
• File status 23 → always code INVALID KEY on every VSAM READ
• -904 / -911 → commit frequently to release DB2 locks and avoid deadlocks