MainframeKit

-913

SQLSTATE 57033NEGATIVE SQLCODE

The statement failed because of a deadlock or timeout, but Db2 did not roll back the unit of work; the program must commit or roll back itself.

MOST LIKELY

The same lock contention that causes -911, in a case where Db2 leaves the rollback decision to the application.

FIRST CHECK

Read the reason code, resource type and resource name in the message.

TRY IT ▸

MainframeKit assistant

What it means

Like -911, this means your work lost a deadlock or waited too long for a lock. The difference is that Db2 has not rolled anything back: only the current statement failed. If it was a cursor FETCH, the cursor has been closed.

The program must now decide: roll back to the last commit point (the usual choice) or commit what it has done. The reason code (also in SQLERRD(3)) is usually 00C90088 for deadlock or 00C9008E for timeout.

Typical causes

  • The same lock contention that causes -911, in a case where Db2 leaves the rollback decision to the application.
  • Batch and online work updating the same data at the same time.
  • Infrequent commits that hold locks for a long time.

How to fix it

  1. Read the reason code, resource type and resource name in the message.
  2. Issue ROLLBACK (or COMMIT if that is correct for your logic) before doing anything else, then normally end the program.
  3. Search SYSLOG around the failure for the related deadlock or timeout messages (for example DSNT376I) to see who held the lock.
  4. Reduce contention by committing more often and accessing data in a consistent order.

Example

Illustrative only; names and values are invented.

DSNT408I SQLCODE = -913, ERROR: UNSUCCESSFUL EXECUTION CAUSED BY DEADLOCK OR TIMEOUT.
         REASON CODE 00C90088, TYPE OF RESOURCE ..., AND RESOURCE NAME ...