ILE RPG Status Codes and Common IBM i Error Messages
A searchable list of ILE RPG program status codes (00100-09999) and file status codes (01000-01999) with IBM's wording, the way to trap each one in free-format RPG, and the usual fix. It also maps the CPF and MCH messages you see in job logs, such as CPF4131 level check and MCH3601 pointer errors, to the status RPG returns.
| Code | Kind | Meaning | How to trap it | Typical fix |
|---|---|---|---|---|
00100 | Program status | Value out of range for string operation | on-error 00100 | Check start and length before %SUBST or SCAN; use %LEN on varying fields. |
00101 | Program status | Negative square root | on-error 00101 | Guard the operand with an IF before %SQRT. |
00102 | Program status | Divide by zero | on-error 00102 | Test the divisor; return 0 or a flag when it is zero. |
00103 | Program status | An intermediate result is not large enough to contain the result | on-error 00103 | Enlarge the result field, or use EVAL(H) and check field sizes; often a total that outgrew packed(9:2). |
00104 | Program status | Float underflow: intermediate value too small for the intermediate result field | on-error 00104 | Rescale the calculation or use decimal instead of float. |
00105 | Program status | Invalid characters in character to numeric conversion functions | on-error 00105 around %DEC or %INT | Validate input text; trim blanks; check the decimal separator. |
00112 | Program status | Invalid Date, Time or Timestamp value | on-error 00112 around %DATE or TEST(DE) | Use TEST(DE) *ISO field or MONITOR before %DATE; legacy zero dates are the usual cause. |
00113 | Program status | Date overflow or underflow (result beyond *HIVAL or below *LOVAL) | on-error 00113 | Check the duration added to the date. |
00114 | Program status | Date mapping error from a 4-digit to a 2-digit year outside 1940-2039 | on-error 00114 | Use *ISO or *CYMD formats instead of *YMD or *MDY. |
00115 | Program status | Variable-length field has a current length that is not valid | on-error 00115 | Usually a varying field overlaid by a data structure or bad parameter: check prototypes. |
00120 | Program status | Table or array out of sequence | on-error 00120 | Sort the array or remove ASCEND/DESCEND. |
00121 | Program status | Array index not valid | on-error 00121 | Check the index is between 1 and %ELEM before use. |
00122 | Program status | OCCUR outside of range | on-error 00122 | Check the occurrence number against the DS OCCURS value. |
00123 | Program status | Reset attempted during initialization step of program | on-error 00123 | Move RESET out of *INZSR initialisation. |
00202 | Program status | Called program or procedure failed; halt indicator (H1 through H9) not on | monitor around CALLP; on-error 00202 | Read the called program's job log entry; it failed with its own error first. |
00211 | Program status | Error calling program or procedure | on-error 00211 | Program not found or not authorised: check library list, EXTPGM name and authority. |
00222 | Program status | Pointer or parameter error | on-error 00222 | Caller passed fewer or shorter parameters than the prototype expects; use OPTIONS(*NOPASS) with %PARMS checks. |
00231 | Program status | Called program or procedure returned with halt indicator on | on-error 00231 | Legacy cycle program set H1-H9; review its error path. |
00333 | Program status | Error on DSPLY operation | on-error 00333 | DSPLY in batch needs a message queue reply or a non-interactive design. |
00401 | Program status | Data area specified on IN/OUT not found | on-error 00401 | Create the data area or correct DTAARA name and library list. |
00413 | Program status | Error on IN/OUT operation | on-error 00413 | Check data area type and length against the DS. |
00414 | Program status | User not authorized to use data area | on-error 00414 | Grant *USE (GRTOBJAUT) or adopt authority. |
00415 | Program status | User not authorized to change data area | on-error 00415 | Grant *CHANGE on the data area. |
00431 | Program status | Data area previously locked by another program | on-error 00431 | Find the holder with WRKOBJLCK and add retry logic. |
00802 | Program status | Commitment control not active | on-error 00802 | STRCMTCTL before COMMIT, or compile SQL with COMMIT(*NONE). |
00907 | Program status | Decimal data error (digit or sign not valid) | on-error 00907 | Bad packed or zoned data in a record or parameter; fix the source data and parameter definitions. |
00970 | Program status | Compiler level does not agree with the RPG IV run-time level | Not normally trapped | Recompile on the target release or install the run-time PTFs. |
09999 | Program status | Program exception in system routine (worded 'Exception message received by procedure' in newer references) | on-error 09999 or on-error *program | Generic: read the job log for the underlying CPF or MCH message. |
01011 | File status | Undefined record type (input record does not match record identifying indicator) | on-error 01011 or %ERROR with (E) | Cycle programs: check record identification codes. |
01021 | File status | Tried to write a record that already exists (duplicate unique key, or duplicate relative record number in a subfile) | write(e) then if %error and %status = 01021 | CHAIN first and UPDATE if found, or generate a new key. |
01022 | File status | Referential constraint error detected on file member | on-error 01022 | Parent row missing or child rows exist; check the constraint with WRKPFCST. |
01023 | File status | Error in trigger program before file operation performed | on-error 01023 | Read the trigger program's message in the job log. |
01024 | File status | Error in trigger program after file operation performed | on-error 01024 | The I/O happened; the after trigger failed. Check commitment control and rollback needs. |
01211 | File status | I/O operation to a closed file | on-error 01211 | USROPN file not opened, or closed earlier; test %OPEN(file) first. |
01215 | File status | OPEN issued to a file already opened | on-error 01215 | Wrap OPEN in if not %open(file). |
01216 | File status | Error on an implicit OPEN/CLOSE operation | INFSR or *PSSR (implicit open happens before calcs) | Any open failure, including level check CPF4131 and file not found: read the job log. |
01217 | File status | Error on an explicit OPEN/CLOSE operation | open(e) then if %error | Same causes as 01216 for USROPN files; check overrides and library list. |
01218 | File status | Record already locked | chain(e) then if %status = 01218 | Another job holds the record (CPF5027 in job log); retry, read with (N) when not updating, or shorten lock time. WAITRCD on the file sets the wait. |
01221 | File status | Update operation attempted without a prior read | update(e) | Read or CHAIN without (N) before UPDATE or DELETE. |
01222 | File status | Record cannot be allocated due to referential constraint error | on-error 01222 | Check the related constraint and the rows it protects. |
01231 | File status | Error on SPECIAL file | on-error 01231 | Check the SPECIAL file handler program. |
01235 | File status | Error in PRTCTL space or skip entries | on-error 01235 | Correct the PRTCTL data structure values. |
01299 | File status | Other I/O error detected | on-error *file | Generic: the job log has the real CPF message. |
CPF4131 | Message | Level check on file: the record format changed since the program was compiled | Surfaces as file status 01216 or 01217 at open | Recompile programs that use the file (DSPPGMREF to find them). LVLCHK(*NO) hides real layout mismatches and can corrupt data. |
CPF5027 | Message | Record in use by another job | File status 01218 | WRKOBJLCK or QSYS2.RECORD_LOCK_INFO shows the holder. |
MCH3601 | Message | Pointer not set for location referenced | Program status 00222 in RPG | Missing parameter or unset pointer; check caller parameter count and %ADDR use. |
MCH1202 | Message | Decimal data error | Program status 00907 | Initialise data structures (INZ) and clean bad numeric data in files. |
MCH1210 | Message | Receiver value too small to hold result | Program status 00103 in RPG | Result field too small for the value: enlarge it or use %SIZE checks. |
RNQxxxx | Message | Unhandled RPG error inquiry; xxxx is the status code, e.g. RNQ0102 or RNQ1218 | Appears only when nothing traps the error | Add MONITOR, (E) or INFSR/*PSSR so batch jobs do not stop on MSGW. |
Program and file status wording follows IBM's ILE RPG Reference pages Program Status Codes and File Status Codes (7.4 and 7.5). Message descriptions are summarised; DSPMSGD RANGE(CPF4131) MSGF(QCPFMSG) shows the exact text on your system.
Get an error handling review
Send one RPG program that fails in production and we will return the MONITOR and file error handling changes it needs.
Optional. The tool and every export work without this. No spam.
How to use it
Search by the code from %STATUS, the RNQ inquiry message or the job log message. The Kind column separates program status codes, file status codes and system messages. The How to trap it column gives the MONITOR group code or the (E) extender pattern; the Typical fix column gives the change that clears the cause in most shops. Any status above 00099 is an error. Program status comes from the program status data structure (PSDS) and %STATUS without a file; file status comes from the file information data structure (INFDS) and %STATUS(file).
- on-error accepts several codes separated by colons, e.g. on-error 01218 : 01221
- on-error *program catches all program status codes, *file all file codes, *all both
- The (E) extender with %ERROR and %STATUS handles one operation without MONITOR
MONITOR and ON-ERROR in free format
Wrap the risky statements in a MONITOR group and list specific codes first, then a catch-all: monitor; chain(e) (custno) custmast; if %error and %status(custmast) = 01218; retry or report; endif; avg = total / count; on-error 00102; avg = 0; on-error *program; dsply ('Error ' + %char(%status)); endmon. The first matching ON-ERROR runs and control continues after ENDMON. A MONITOR does not catch errors in a called program; that program needs its own handling or the caller sees 00202. INFSR and *PSSR subroutines still work and are the only way to catch errors during implicit file open, before calculations start.
Worked example: level check after a file change
A developer adds a column to the customer master and recreates the physical file. The next morning order entry ends with CPF4131 and RPG status 01216 on its implicit open, because the format level identifier stored in the program no longer matches the file. The safe fix is to find every program that uses the file (DSPPGMREF to an outfile, then query it) and recompile them. Changing the file to LVLCHK(*NO) makes the error go away, but programs then read fields at the old offsets and can write the wrong data into the wrong columns. Adding columns through SQL ALTER TABLE has the same effect on level checks.
Debug path
Compile with DBGVIEW(*SOURCE) (or *LIST), then STRDBG PGM(lib/pgm) UPDPROD(*YES) for production-library data, set a breakpoint at the failing statement number from the job log, and call the program. For a batch job use STRSRVJOB on the job, then STRDBG, and release it. In RDi or Code for IBM i the service entry point does the same with a graphical debugger. The job log (DSPJOBLOG, or QSYS2.JOBLOG_INFO from SQL) shows the original message, the statement number and the procedure, which is usually enough to find the line without a debugger.
Frequently Asked Questions
What is a level check error in AS400?
CPF4131 level check means the record format of a file changed after the program was compiled, so the format level identifier no longer matches. RPG reports it as file status 01216 or 01217 at open. Recompile every program that uses the file. Avoid LVLCHK(*NO) as a fix: it lets programs read and write at old field positions.
What does pointer or parameter error mean in AS400?
RPG status 00222, often with MCH3601 in the job log, means a program used a parameter or pointer that was not passed or not set. The usual cause is a caller passing fewer or shorter parameters than the called program's prototype expects. Match the prototypes, and for optional parameters use OPTIONS(*NOPASS) and test %PARMS before touching them.
How do I handle errors in RPG without the program stopping?
Use MONITOR with ON-ERROR for blocks of code, the (E) extender with %ERROR and %STATUS for single file operations, and INFSR or *PSSR for errors outside calculations such as implicit opens. Without any of these, an error raises an RNQ inquiry message and a batch job sits in MSGW until someone answers it.
What is file status 01218 in RPG?
01218 means record already locked: another job holds a lock on the record you tried to read for update. The job log shows CPF5027 with the holding job. Read with the (N) extender when you do not intend to update, keep the time between read and update short, and add a retry with %STATUS = 01218 checks.
If your support team spends time decoding RPG errors and job logs, we can set up a private assistant on your IBM i that reads the job log, finds the source line and explains the fix, on your own servers.
Related Tools
IBM i RPGLE Fully Free Program Skeleton Generator (SQL, MONITOR)
Fill in your table and columns and get a complete fully free ILE RPG program that reads rows with an SQL cursor, handles SQL and runtime errors, and compiles with one CRTSQLRPGI command.
Developer ToolsIBM i RPGLE Service Program Generator (NOMAIN, Binder Source, CRTSRVPGM)
Generate a complete ILE RPG service program kit: NOMAIN module with exported procedures, prototype copybook, binder source with a signature, binding directory and the CL to build and call it.
Developer ToolsIBM i Services (QSYS2 and SYSTOOLS) SQL Reference
Searchable list of IBM i Services you can query with SQL from Run SQL Scripts, STRSQL or ODBC, with the CL command each replaces and a ready-to-run statement.
OracleIBM i CL Command Cheat Sheet
A searchable lookup of the CL commands operators and JDE World support staff use daily, grouped by task with a short note on each.
More Developer Tools tools
See all- IBM i Query/400 (WRKQRY) Record Selection Tests and Result Field Reference
- IBM i Journal Receiver Growth and Retention Calculator
- SAP Sales Order ABAP SELECT Generator (VBAK, VBAP, VBFA)
- SAP Sales Order Create BAPI ABAP Generator (BAPI_SALESORDER_CREATEFROMDAT2)
- SAP ABAP Open Items SELECT Generator
- SAP ACDOCA SQL Query Generator
- SAP QM Inspection Lot ABAP SELECT Generator
- SAP Quality Notification Pareto SQL Query Generator
- SAP QM Usage Decision BAPI Skeleton
Keep exploring
Free tools
- IBM i RPGLE Fully Free Program Skeleton Generator (SQL, MONITOR)Fill in your table and columns and get a complete fully free ILE RPG program that reads rows with an SQL cursor, handles SQL and runtime errors, and compiles with one CRTSQLRPGI command.
- IBM i (AS/400) Custom RPG Applications Private AI Layer Blueprint GeneratorFill in your IBM i RPG environment and export an architecture plan for a private, on-prem AI assistant: components, security controls, rollout and open questions.
- IBM i (AS/400) Custom RPG Applications AI Assistant Sizing and Value CalculatorEstimate GPU count, token volume, index size and payback for a private AI assistant on IBM i RPG from users, usage and time saved.
ERP fixes and how-tos
- How to Add AI to an IBM i (AS/400) RPG Application Without Moving ItHow to add a private AI assistant to custom RPG applications on IBM i: Db2 for i access, field names, journals, RCAC security, local LLM, sizing and rollout.
- Infor XA REST API: expose XA through IBM i Integrated Web Services or IONHow to expose Infor XA (MAPICS) data and functions as REST on IBM i using Integrated Web Services or ION, with an example call and the safety rules for writes.
- SAP Error Message MM899 and the Most Common MM Error MessagesWhat SAP message MM899 means, how to read the real error behind it with SE91 and long text, and a practical guide to the most common MM, M7 and ME messages.
Integrations
- How to add AI agents to Infor XA on IBM iHow to add AI agents to Infor XA on IBM i: a tool layer over Db2 for i and RPG programs, approval gates, on-prem models, and realistic expedite and exception flows.
- How to add WhatsApp to JD Edwards World on IBM iHow to connect WhatsApp Business to JD Edwards World on IBM i: data queues, DB2 for i triggers, template messages, supplier replies and approvals back into World.