Common SQL and file-operation errors
Plain-English IBM i learning notes with examples, comparisons, and official references.
SQLSTATE 02000 / %EOF — No row or end of data
What to do next: Branch before using host variables or record fields; do not process the previous row again.
SQLSTATE 23505 / duplicate key — A unique rule rejected the insert or update
What to do next: Decide whether this is an expected business conflict or an application defect; do not blindly retry.
SQL7008 — The object is not valid for the requested SQL operation; the reason detail matters
What to do next: Read the complete diagnostic, then inspect journaling, commitment control, object type, and authority for that reason.
RPG status 1218 / record in use — A record is locked by another job
What to do next: Inspect the holder, use a bounded retry only when safe, and re-read before updating.
RPG %FOUND false or %EOF true — The keyed read did not find a row or the scan reached its boundary
What to do next: Handle the branch explicitly and reset/reposition before trying another scan.
CPF4131 / level check — The compiled file format does not match the file being opened
What to do next: Identify the resolved object and format change, then rebuild or deploy the compatible pair in a controlled sequence.