# ILE RPG Status Codes and Common IBM i Error Messages

> Source: https://netray.co/tools/ibm-i-rpg-status-codes-reference
> Publisher: Netray (netray.co), AI and integration engineering for ERP and manufacturing systems.
> Section: Free Tools

## Short answer

Look up ILE RPG program and file status codes with IBM's wording, the MONITOR or %ERROR pattern that traps each one, and the usual fix, plus the CPF and MCH messages behind them.

## Category

developer

## Erp

IBM i

## Audience

- RPG developer
- IBM i administrator
- ERP support analyst

## Tool

**Kind:** worksheet

**Mode:** reference

**Columns:**

#### Code

**Key:** code

**Type:** text

#### Kind

**Key:** kind

**Type:** select

**Options:**

- Program status
- File status
- Message

#### Meaning

**Key:** meaning

**Type:** text

#### How to trap it

**Key:** monitorTip

**Type:** text

#### Typical fix

**Key:** typicalFix

**Type:** text

**Rows:**

**Code:** 00100

**Kind:** Program status

**Meaning:** Value out of range for string operation

**Monitor Tip:** on-error 00100

**Typical Fix:** Check start and length before %SUBST or SCAN; use %LEN on varying fields.

**Code:** 00101

**Kind:** Program status

**Meaning:** Negative square root

**Monitor Tip:** on-error 00101

**Typical Fix:** Guard the operand with an IF before %SQRT.

**Code:** 00102

**Kind:** Program status

**Meaning:** Divide by zero

**Monitor Tip:** on-error 00102

**Typical Fix:** Test the divisor; return 0 or a flag when it is zero.

**Code:** 00103

**Kind:** Program status

**Meaning:** An intermediate result is not large enough to contain the result

**Monitor Tip:** on-error 00103

**Typical Fix:** Enlarge the result field, or use EVAL(H) and check field sizes; often a total that outgrew packed(9:2).

**Code:** 00104

**Kind:** Program status

**Meaning:** Float underflow: intermediate value too small for the intermediate result field

**Monitor Tip:** on-error 00104

**Typical Fix:** Rescale the calculation or use decimal instead of float.

**Code:** 00105

**Kind:** Program status

**Meaning:** Invalid characters in character to numeric conversion functions

**Monitor Tip:** on-error 00105 around %DEC or %INT

**Typical Fix:** Validate input text; trim blanks; check the decimal separator.

**Code:** 00112

**Kind:** Program status

**Meaning:** Invalid Date, Time or Timestamp value

**Monitor Tip:** on-error 00112 around %DATE or TEST(DE)

**Typical Fix:** Use TEST(DE) *ISO field or MONITOR before %DATE; legacy zero dates are the usual cause.

**Code:** 00113

**Kind:** Program status

**Meaning:** Date overflow or underflow (result beyond *HIVAL or below *LOVAL)

**Monitor Tip:** on-error 00113

**Typical Fix:** Check the duration added to the date.

**Code:** 00114

**Kind:** Program status

**Meaning:** Date mapping error from a 4-digit to a 2-digit year outside 1940-2039

**Monitor Tip:** on-error 00114

**Typical Fix:** Use *ISO or *CYMD formats instead of *YMD or *MDY.

**Code:** 00115

**Kind:** Program status

**Meaning:** Variable-length field has a current length that is not valid

**Monitor Tip:** on-error 00115

**Typical Fix:** Usually a varying field overlaid by a data structure or bad parameter: check prototypes.

**Code:** 00120

**Kind:** Program status

**Meaning:** Table or array out of sequence

**Monitor Tip:** on-error 00120

**Typical Fix:** Sort the array or remove ASCEND/DESCEND.

**Code:** 00121

**Kind:** Program status

**Meaning:** Array index not valid

**Monitor Tip:** on-error 00121

**Typical Fix:** Check the index is between 1 and %ELEM before use.

**Code:** 00122

**Kind:** Program status

**Meaning:** OCCUR outside of range

**Monitor Tip:** on-error 00122

**Typical Fix:** Check the occurrence number against the DS OCCURS value.

**Code:** 00123

**Kind:** Program status

**Meaning:** Reset attempted during initialization step of program

**Monitor Tip:** on-error 00123

**Typical Fix:** Move RESET out of *INZSR initialisation.

**Code:** 00202

**Kind:** Program status

**Meaning:** Called program or procedure failed; halt indicator (H1 through H9) not on

**Monitor Tip:** monitor around CALLP; on-error 00202

**Typical Fix:** Read the called program's job log entry; it failed with its own error first.

**Code:** 00211

**Kind:** Program status

**Meaning:** Error calling program or procedure

**Monitor Tip:** on-error 00211

**Typical Fix:** Program not found or not authorised: check library list, EXTPGM name and authority.

**Code:** 00222

**Kind:** Program status

**Meaning:** Pointer or parameter error

**Monitor Tip:** on-error 00222

**Typical Fix:** Caller passed fewer or shorter parameters than the prototype expects; use OPTIONS(*NOPASS) with %PARMS checks.

**Code:** 00231

**Kind:** Program status

**Meaning:** Called program or procedure returned with halt indicator on

**Monitor Tip:** on-error 00231

**Typical Fix:** Legacy cycle program set H1-H9; review its error path.

**Code:** 00333

**Kind:** Program status

**Meaning:** Error on DSPLY operation

**Monitor Tip:** on-error 00333

**Typical Fix:** DSPLY in batch needs a message queue reply or a non-interactive design.

**Code:** 00401

**Kind:** Program status

**Meaning:** Data area specified on IN/OUT not found

**Monitor Tip:** on-error 00401

**Typical Fix:** Create the data area or correct DTAARA name and library list.

**Code:** 00413

**Kind:** Program status

**Meaning:** Error on IN/OUT operation

**Monitor Tip:** on-error 00413

**Typical Fix:** Check data area type and length against the DS.

**Code:** 00414

**Kind:** Program status

**Meaning:** User not authorized to use data area

**Monitor Tip:** on-error 00414

**Typical Fix:** Grant *USE (GRTOBJAUT) or adopt authority.

**Code:** 00415

**Kind:** Program status

**Meaning:** User not authorized to change data area

**Monitor Tip:** on-error 00415

**Typical Fix:** Grant *CHANGE on the data area.

**Code:** 00431

**Kind:** Program status

**Meaning:** Data area previously locked by another program

**Monitor Tip:** on-error 00431

**Typical Fix:** Find the holder with WRKOBJLCK and add retry logic.

**Code:** 00802

**Kind:** Program status

**Meaning:** Commitment control not active

**Monitor Tip:** on-error 00802

**Typical Fix:** STRCMTCTL before COMMIT, or compile SQL with COMMIT(*NONE).

**Code:** 00907

**Kind:** Program status

**Meaning:** Decimal data error (digit or sign not valid)

**Monitor Tip:** on-error 00907

**Typical Fix:** Bad packed or zoned data in a record or parameter; fix the source data and parameter definitions.

**Code:** 00970

**Kind:** Program status

**Meaning:** Compiler level does not agree with the RPG IV run-time level

**Monitor Tip:** Not normally trapped

**Typical Fix:** Recompile on the target release or install the run-time PTFs.

**Code:** 09999

**Kind:** Program status

**Meaning:** Program exception in system routine (worded 'Exception message received by procedure' in newer references)

**Monitor Tip:** on-error 09999 or on-error *program

**Typical Fix:** Generic: read the job log for the underlying CPF or MCH message.

**Code:** 01011

**Kind:** File status

**Meaning:** Undefined record type (input record does not match record identifying indicator)

**Monitor Tip:** on-error 01011 or %ERROR with (E)

**Typical Fix:** Cycle programs: check record identification codes.

**Code:** 01021

**Kind:** File status

**Meaning:** Tried to write a record that already exists (duplicate unique key, or duplicate relative record number in a subfile)

**Monitor Tip:** write(e) then if %error and %status = 01021

**Typical Fix:** CHAIN first and UPDATE if found, or generate a new key.

**Code:** 01022

**Kind:** File status

**Meaning:** Referential constraint error detected on file member

**Monitor Tip:** on-error 01022

**Typical Fix:** Parent row missing or child rows exist; check the constraint with WRKPFCST.

**Code:** 01023

**Kind:** File status

**Meaning:** Error in trigger program before file operation performed

**Monitor Tip:** on-error 01023

**Typical Fix:** Read the trigger program's message in the job log.

**Code:** 01024

**Kind:** File status

**Meaning:** Error in trigger program after file operation performed

**Monitor Tip:** on-error 01024

**Typical Fix:** The I/O happened; the after trigger failed. Check commitment control and rollback needs.

**Code:** 01211

**Kind:** File status

**Meaning:** I/O operation to a closed file

**Monitor Tip:** on-error 01211

**Typical Fix:** USROPN file not opened, or closed earlier; test %OPEN(file) first.

**Code:** 01215

**Kind:** File status

**Meaning:** OPEN issued to a file already opened

**Monitor Tip:** on-error 01215

**Typical Fix:** Wrap OPEN in if not %open(file).

**Code:** 01216

**Kind:** File status

**Meaning:** Error on an implicit OPEN/CLOSE operation

**Monitor Tip:** INFSR or *PSSR (implicit open happens before calcs)

**Typical Fix:** Any open failure, including level check CPF4131 and file not found: read the job log.

**Code:** 01217

**Kind:** File status

**Meaning:** Error on an explicit OPEN/CLOSE operation

**Monitor Tip:** open(e) then if %error

**Typical Fix:** Same causes as 01216 for USROPN files; check overrides and library list.

**Code:** 01218

**Kind:** File status

**Meaning:** Record already locked

**Monitor Tip:** chain(e) then if %status = 01218

**Typical Fix:** 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.

**Code:** 01221

**Kind:** File status

**Meaning:** Update operation attempted without a prior read

**Monitor Tip:** update(e)

**Typical Fix:** Read or CHAIN without (N) before UPDATE or DELETE.

**Code:** 01222

**Kind:** File status

**Meaning:** Record cannot be allocated due to referential constraint error

**Monitor Tip:** on-error 01222

**Typical Fix:** Check the related constraint and the rows it protects.

**Code:** 01231

**Kind:** File status

**Meaning:** Error on SPECIAL file

**Monitor Tip:** on-error 01231

**Typical Fix:** Check the SPECIAL file handler program.

**Code:** 01235

**Kind:** File status

**Meaning:** Error in PRTCTL space or skip entries

**Monitor Tip:** on-error 01235

**Typical Fix:** Correct the PRTCTL data structure values.

**Code:** 01299

**Kind:** File status

**Meaning:** Other I/O error detected

**Monitor Tip:** on-error *file

**Typical Fix:** Generic: the job log has the real CPF message.

**Code:** CPF4131

**Kind:** Message

**Meaning:** Level check on file: the record format changed since the program was compiled

**Monitor Tip:** Surfaces as file status 01216 or 01217 at open

**Typical Fix:** Recompile programs that use the file (DSPPGMREF to find them). LVLCHK(*NO) hides real layout mismatches and can corrupt data.

**Code:** CPF5027

**Kind:** Message

**Meaning:** Record in use by another job

**Monitor Tip:** File status 01218

**Typical Fix:** WRKOBJLCK or QSYS2.RECORD_LOCK_INFO shows the holder.

**Code:** MCH3601

**Kind:** Message

**Meaning:** Pointer not set for location referenced

**Monitor Tip:** Program status 00222 in RPG

**Typical Fix:** Missing parameter or unset pointer; check caller parameter count and %ADDR use.

**Code:** MCH1202

**Kind:** Message

**Meaning:** Decimal data error

**Monitor Tip:** Program status 00907

**Typical Fix:** Initialise data structures (INZ) and clean bad numeric data in files.

**Code:** MCH1210

**Kind:** Message

**Meaning:** Receiver value too small to hold result

**Monitor Tip:** Program status 00103 in RPG

**Typical Fix:** Result field too small for the value: enlarge it or use %SIZE checks.

**Code:** RNQxxxx

**Kind:** Message

**Meaning:** Unhandled RPG error inquiry; xxxx is the status code, e.g. RNQ0102 or RNQ1218

**Monitor Tip:** Appears only when nothing traps the error

**Typical Fix:** Add MONITOR, (E) or INFSR/*PSSR so batch jobs do not stop on MSGW.

**Notes:** 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.

## Content

**Intro:** 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.

**Sections:**

#### How to use it

**Body:** 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).

**Bullets:**

- 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

**Body:** 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

**Body:** 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

**Body:** 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.

**Cta:** 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.

**Faq:**

#### What is a level check error in AS400?

**Answer:** 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?

**Answer:** 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?

**Answer:** 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?

**Answer:** 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.

## Search terms

error handling in rpg, error handling in as400, level check error in as400, pointer or parameter error in as400, rpg status codes, rpg file status 01218, how to debug rpg program in as400, rpg program cycle

---
Talk to an engineer: https://netray.co/contact?intent=erp_ai | Machine catalog: https://netray.co/agent/catalog.json
