Production DB2 for z/OS applications live and die by resource availability and locks. -904 says something you need is not available. -911 and -913 say you lost a deadlock or timeout fight—with different rollback and SQLSTATE behavior. This page covers all three.
Class 57 SQLSTATE values are about resources (unavailable, limit exceeded, operator intervention). Class 40 is transaction rollback. Always capture reason-code, resource-type, and resource-name from the message / SQLCA tokens—those three fields are the real diagnosis, not the SQLCODE alone.
| SQLCODE | SQLSTATE | Meaning |
|---|---|---|
| -904 | 57011 | Required resource unavailable |
| -911 | 40001 | UOW rolled back: deadlock or timeout |
| -913 | 57033 | Unsuccessful: deadlock or timeout |
IBM: UNSUCCESSFUL EXECUTION CAUSED BY AN UNAVAILABLE RESOURCE. REASON reason-code, TYPE OF RESOURCE resource-type, AND RESOURCE NAME resource-name.
The SQL statement needed something that was not available. Reason codes are documented in the Db2 reason-code volume. Resource-type and resource-name identify what was missing. Special cases IBM calls out:
System action: statement cannot be processed. If it was a cursor FETCH, Db2 closes the cursor—so a later FETCH may show -501 even though the root problem was -904.
Programmer response: collect SYSLOG across the failure window; search related messages; identify the resource; look up the reason-code. If the name is an optimum buffer pool, define that buffer pool or place the table in a table space that uses an existing pool. For accelerator -904, contact accelerator support with the message text. SQLSTATE 57011.
12345678Example token pattern (illustrative): SQLCODE = -904 reason-code = 00D70024 (example — look up YOUR code) resource-type = ... resource-name = DBNAME.TSNAME or data set name Next: DISPLAY DATABASE(...) SPACENAM(...) check STOP/RESTRICT status, HSM migrate, BP allocation
IBM: THE CURRENT UNIT OF WORK HAS BEEN ROLLED BACK DUE TO DEADLOCK OR TIMEOUT. REASON reason-code, TYPE OF RESOURCE resource-type, AND RESOURCE NAME resource-name.
Your UOW was the victim. Attention: changes associated with the unit of work must be entered again. SQLERRD(3) also contains the reason-code. Most common:
System action: statement cannot be processed; application rolled back to the previous COMMIT. Programmer response: SYSLOG for related messages; long-running apps should COMMIT frequently when possible; see DSNT376I for avoidance tips. On receipt of -911, the application should in general terminate. SQLSTATE 40001.
123456EVALUATE SQLCODE WHEN -911 DISPLAY 'DEADLOCK/TIMEOUT - UOW ROLLED BACK' DISPLAY 'SEE SQLERRD(3) FOR 00C90088 VS 00C9008E' * Re-drive business unit from last commit; often end task END-EVALUATE
IBM: UNSUCCESSFUL EXECUTION CAUSED BY DEADLOCK OR TIMEOUT. REASON CODE reason-code, TYPE OF RESOURCE resource-type, AND RESOURCE NAME resource-name.
You were a victim of deadlock or timeout. Same common reason codes: 00C90088 / 00C9008E. SQLERRD(3) holds the reason-code.
System action: statement cannot be processed. If it was FETCH, Db2 closes the cursor. Programmer response: SYSLOG; application should either COMMIT or ROLLBACK to the previous COMMIT, then generally terminate; see DSNT376I. SQLSTATE 57033.
Both are lock-contention outcomes. -911 documents that the current unit of work was rolled back (SQLSTATE 40001). -913 documents unsuccessful execution from deadlock/timeout (SQLSTATE 57033) and tells the app to COMMIT or ROLLBACK, then usually terminate. Do not assume you can continue updating as if nothing happened—inspect SQLCA, release/hold strategy, and whether your cursor survived.
Deadlocks (00C90088) often come from two transactions locking the same objects in opposite order. Standardize access paths (touch tables in the same sequence).
Holding locks across huge batch windows invites timeouts (00C9008E). COMMIT at safe business boundaries. Watch WITH HOLD cursors and what survives COMMIT.
Higher isolation and larger lock sizes increase conflict. Tune with care—correctness first. See lock-size and isolation tutorials for the levers.
Cursor is closed. Re-OPEN only after the resource is available again; otherwise you chase -501. Log the original -904 tokens before any CLOSE/OPEN cleanup so operators still see the real unavailable resource.
Use SQLERRD(3) / message reason-code: 00C90088 points you at deadlock graphs and lock order; 00C9008E points you at IRLM wait times, long units of work, and holders that never commit. DSNT376I and related DSNT5xx messages often name the other agents. Do not “fix” timeouts by raising lock wait forever without fixing the holder—you only delay the outage.
-904 is “the toy box is locked in the closet—you cannot play until someone opens the closet.” -911 is “two kids grabbed toys in a circle, a grown-up reset the game, and your turns are undone.” -913 is “you lost the waiting game for a toy; stop and put your pieces back (commit or roll back) before you try again.”
1. SQLCODE -904 means:
2. SQLCODE -911 means:
3. How does -913 differ from -911?
4. SQLERRD(3) on -911/-913 often holds:
5. A practical way to reduce -911/-913 is: