What it means
-913 reports the same lock problems as -911. Reason 00C90088 is a deadlock and 00C9008E is a timeout. The message gives the type and name of the locked resource, and SQLERRD(3) in the SQLCA holds the reason code too.
The difference is what has happened to your work. With -911 the rollback is already done. With -913 only the failing statement is undone. Changes made earlier in the unit of work are still there and still hold their locks, so the program has to decide what to do next.
You see -913 when the environment leaves that decision to the application. The common case is CICS, when the DB2ENTRY for the transaction, or DB2CONN for pool threads, is defined with DROLLBACK(NO). With the default, DROLLBACK(YES), CICS rolls back the task and the program gets -911 instead.
Common causes
- A long-running batch job or transaction holds locks without committing, and this program times out waiting for them.
- Two transactions update the same rows or pages in a different order and deadlock.
- The CICS DB2ENTRY or DB2CONN uses DROLLBACK(NO), so the error comes back as -913 rather than -911.
- Repeatable read or read stability isolation keeps share locks longer than needed.
How to find the problem
- Read the reason code to tell a deadlock (00C90088) from a timeout (00C9008E).
- Find DSNT375I (deadlock) or DSNT376I (timeout) in the Db2 master address space log at the same time. They name the other plan and its correlation ID, which in CICS includes the transaction ID.
- Check the DROLLBACK setting on the DB2ENTRY for the transaction, or on DB2CONN for pool threads, in the CICS resource definitions.
- Use the resource name to find the table space, and SYSIBM.SYSTABLES to see which tables live in it.
How to fix it
- Handle -913 in the program. Roll back (EXEC CICS SYNCPOINT ROLLBACK in CICS) so the locks held by earlier work are released, then retry the unit of work or end the task.
- Don't just repeat the failing statement and carry on unless you're sure the earlier work is still valid. The other program may have changed data you already read.
- Keep units of work short, and commit batch work often so online transactions don't wait.
- Access tables in the same order in every program to avoid deadlocks.
- If your programs don't handle -913, use DROLLBACK(YES) so CICS rolls back for them.
What it looks like
CLMUPD - UPDATE CLAIM_LINE FAILED, CLAIM 004471209
DSNT408I SQLCODE = -913, ERROR: UNSUCCESSFUL EXECUTION CAUSED BY DEADLOCK OR TIMEOUT.
REASON CODE 00C90088, TYPE OF RESOURCE 00000302, AND RESOURCE NAME
CLMDB.CLMTS02.X'00031C'
DSNT418I SQLSTATE = 57033 SQLSTATE RETURN CODE