Besides +100, DB2 for z/OS returns other positive SQLCODEs when a statement succeeds with a warning. This page covers the ones you will actually see—especially +802—and then the checklist names +805, +818, +811, +904, +911, and +913. Those last numbers are almost always the negative errors of the same digits. Getting the sign wrong sends a COBOL program down the warning path during a deadlock.
| SQLCODE | Meaning |
|---|---|
| +222 | Hole on SENSITIVE STATIC FETCH (row deleted or no longer qualifies). SQLSTATE 02502. |
| +231 | FETCH CURRENT/RELATIVE 0 but cursor not on a row/rowset. SQLSTATE 02000. |
| +304 | Fetched value not in range of the host variable. SQLSTATE 01515. |
| +445 | Value truncated. SQLSTATE 01004. |
| +562 | GRANT of a privilege was ignored (already held or not applicable). SQLSTATE 01516. |
| +610 | CREATE/ALTER on an object in a pending state (definition change not fully materialized). |
| +802 | Arithmetic exception in outer SELECT list; indicator -2; statement continues. SQLSTATE 01519. |
| +904 | Unavailable resource but continue—not issued by Db2 z/OS itself (Accelerator cases). SQLSTATE 01687. |
IBM: an exception (decimal overflow, divide, exponent overflow, fixed-point overflow, invalid operation, overflow, subnormal, underflow, zero divide) occurred while adding, subtracting, multiplying, dividing, negating, or applying a built-in function to DECIMAL, FLOAT, SMALLINT, or INTEGER data in an outer SELECT-list expression. Position-number is the select-list item.
System action: the indicator variable for that expression is -2 (null); the data host is unchanged; other columns and expressions still return; a cursor stays open. SQLSTATE 01519. Programmer response: inspect the expression and the data. Allowed numeric ranges are discussed with SQLCODE -405.
This is not “the job failed.” A report program can print the other columns and show NULL for salary. If your shop treats any arithmetic problem as fatal, test for +802 (and SQLWARN flags) and escalate. There is also a negative -802 when the arithmetic failure is not handled as a SELECT-list warning—do not assume 802 is always plus.
123456789EXEC SQL SELECT EMPNO, SALARY / :HV-DIVISOR INTO :HV-EMPNO, :HV-RATIO:HV-RATIO-IND FROM EMP WHERE EMPNO = :HV-KEY END-EXEC. IF SQLCODE = +802 OR HV-RATIO-IND = -2 DISPLAY 'ARITHMETIC WARNING ON RATIO' END-IF.
+222: while FETCHing a SENSITIVE STATIC cursor, Db2 refetched the base row and found a delete hole (row gone) or update hole (row no longer satisfies the predicate). No data is fetched; the cursor sits on the hole. SQLSTATE 02502. Raise isolation or handle holes in the program.
+231: FETCH orientation CURRENT, CURRENT ROWSET, RELATIVE 0, or ROWSET STARTING AT RELATIVE 0 when the cursor is not on a row. Nothing fetched; position unchanged. Typical after you already saw +100 or +222 and then asked for CURRENT.
+304: a fetched value does not fit the host variable’s range (for example a large DECIMAL into a SMALLINT host). SQLSTATE 01515. Fix the host type or CAST.
+445: a value was truncated. SQLSTATE 01004. Common with CHAR/VARCHAR conversions. Pair with SQLWARN1 when the destination is a host variable.
+562: GRANT was ignored because the privilege was already held or could not be applied that way. The GRANT statement still “succeeds.” Do not treat it as a security failure unless your installer requires every GRANT to change something.
+610: CREATE or ALTER touched an object whose definition change is pending (materializing REORG not done yet). The statement worked; the object may not be fully in the new shape until REORG.
IBM documents +904 as “A RESOURCE IS UNAVAILABLE BUT PROCESSING CONTINUES” (SQLSTATE 01687) and states that Db2 for z/OS does not issue that SQLCODE. The Analytics Accelerator may return +904 on SQL OPEN for some accelerated queries when CURRENT QUERY ACCELERATION WAITFORDATA is used. Processing continues on the accelerator.
The code every DBA means by “904” is -904: unsuccessful execution because a resource was unavailable (reason-code, resource-type, resource-name). SQLSTATE 57011. A FETCH that hits -904 closes the cursor; later FETCH without OPEN is -501. Look up the reason code in the Codes book; SYSLOG often has the matching DSNT message.
| Actual SQLCODE | Meaning |
|---|---|
| -805 | Package/DBRM + consistency token not found in the plan. SQLSTATE 51002. Reason 01–04. |
| -818 | Load-module timestamp ≠ bind timestamp from the DBRM. SQLSTATE 51003. |
| -811 | Singleton SELECT or scalar subquery returned more than one row/value. SQLSTATE 21000. |
| -904 | Resource unavailable; statement fails; FETCH may close the cursor. SQLSTATE 57011. |
| -911 | Deadlock or timeout; UR rolled back. SQLSTATE 40001. 00C90088 / 00C9008E. |
| -913 | Deadlock or timeout; statement fails, UR not rolled back. SQLSTATE 57033. |
-805: the package location.collection.dbrm.consistency-token was not found in plan-name. Reason 01 no PKLIST, 02 name did not match a list entry, 03 matched entries but no package (wrong version / not bound), 04 missing at a remote site. Fix BIND/PKLIST/CURRENT PACKAGESET or run the matching load module.
-818: precompiler timestamp in the load module ≠ bind timestamp from the DBRM. You compiled without binding, bound without linking, or mixed a DBRM from a different precompile. Bind and link the same precompile output. SQLSTATE 51003.
Embedded SELECT or UPDATE SET subselect returned more than one row, or a basic predicate subquery returned more than one value. SQLSTATE 21000. Use a cursor, add a more selective predicate, or use an aggregate. Opposite of +100 (zero rows).
Both can be deadlock (00C90088) or timeout (00C9008E); SQLERRD(3) has the reason. -911 rolls back the UR (SQLSTATE 40001)—re-enter the work. -913 does not roll back (SQLSTATE 57033)—you COMMIT or ROLLBACK, and a FETCH -913 closes the cursor. Neither is a warning. IF SQLCODE = +911 will never see a deadlock.
123456789IF SQLCODE = -911 DISPLAY 'UR ROLLED BACK DEADLOCK/TIMEOUT' PERFORM RESTART-UNIT-OF-WORK ELSE IF SQLCODE = -913 DISPLAY 'STATEMENT FAILED LOCKS - DECIDE ROLLBACK' EXEC SQL ROLLBACK END-EXEC END-IF END-IF.
Plus codes (other than empty-jar +100) are “you got the cookie, but look: a crumb fell off” (+802: that one chocolate chip is missing so we handed you a napkin null). Minus 805/818 are “wrong lunchbox—this sandwich does not match the label.” Minus 811 is “you asked for one cookie and twelve fell out.” Minus 911 is “food fight—we took everyone’s trays back.” Minus 913 is “food fight at your table only—you still have to decide whether to keep eating.” Writing a plus in front of 911 does not make the food fight a crumb.
1. SQLCODE +802 on z/OS means:
2. Which of these is a real positive SQLCODE on Db2 for z/OS?
3. SQLCODE +904 on z/OS is:
4. -911 versus -913:
5. +445 means: