Db2 Troubleshooting
SQLCODE +100 no row found
SQLCODE +100: no row found — the SELECT/UPDATE/DELETE matched zero rows. Not an error, but often unexpected.
What it means
- After every EXEC SQL, DB2 returns a SQLCODE: 0 means success, +100 means no row found, and negative values mean an error.
Common causes
- WHERE clause filters out every row (wrong key value).
- Cursor FETCH past the last row (normal end-of-data).
- Data was deleted or never inserted.
How to diagnose
- Run the same SELECT in SPUFI with the host variable values.
- Check whether FETCH loop handles +100 as end-of-data.
- Verify the key values the program passes.
How to fix it
- Handle +100 explicitly: treat as "not found" business logic.
- Fix the key values or insert the missing row.
Example: Handle +100 as end-of-data
EXEC SQL FETCH C1 INTO :WS-ROW END-EXEC.
IF SQLCODE = 100
MOVE 'Y' TO WS-EOF
END-IF.
+100 on FETCH is the normal loop terminator.
Interview tip
- Q: How would you troubleshoot a SQLCODE +100 no row found in production?
- A: I would check the SQLCODE and SQLERRM immediately after the failing statement, reproduce in SPUFI, then apply the specific fix.
Prevention checklist
- Always check SQLCODE after every EXEC SQL statement.
- Log the SQLCODE, SQLSTATE and failing statement for support.
