Diagnostic Reference

Errors raised when a name does not resolve, a name is declared twice, or a statement's operands do not fit the operation.

Code Message Cause Resolution
TRN2100 Duplicate variable declaration '{name}' The name is already declared. A data structure's subfields count: in a non-qualified structure the subfields live in the program's global namespace, so a standalone variable cannot reuse one of their names. Mirrors IBM i RNF3315. Rename one of them, or qualify the structure so its subfields take a dotted path of their own.
TRN2101 Duplicate constant declaration '{name}' Two DCL-C declarations share a name. Rename one, or delete the redundant declaration.
TRN2102 Duplicate enumeration declaration '{name}' Two DCL-ENUM declarations share a name. Rename one, or delete the redundant declaration.
TRN2103 Duplicate data structure declaration '{name}' Two DCL-DS declarations share a name. Mirrors IBM i RNF3221. Rename one, or delete the redundant declaration.
TRN2104 Duplicate subfield declaration '{name}' The subfield name is already in use. Subfields of a non-qualified structure share the global namespace, so two non-qualified structures cannot both declare the same subfield name. IBM i reports RNF3315 at severity 20 and produces no program object at the default GENLVL. Qualify one of the structures, or rename the subfield.
TRN2105 Duplicate display file declaration '{name}' Two DCL-F ... WORKSTN declarations share a name. Rename one, or delete the redundant declaration.
TRN2106 LIKEDS on '{name}' forms a cycle through '{ref}' The LIKEDS chain returns to a structure already being expanded - for example A LIKEDS(B) with B LIKEDS(A). Neither structure can be laid out, because each needs the other's subfields first. Break the cycle: give one structure its subfields directly, or introduce a third structure both copy from.
TRN2107 LIKEDS references undefined data structure '{name}' No data structure of that name is declared anywhere in the module. Declaration order does not matter - a template declared below the structure that names it resolves normally - so this fires only when the name is genuinely absent. Declare the structure, or correct the name.
TRN2108 Undefined data structure '{name}' on EVAL-CORR target The EVAL-CORR target names no declared data structure. Mirrors IBM i RNF0659. Declare it, or correct the name.
TRN2109 Undefined data structure '{name}' on EVAL-CORR source The EVAL-CORR source names no declared data structure. Mirrors IBM i RNF0659. Declare it, or correct the name.
TRN2110 EVAL-CORR finds no corresponding subfields between '{target}' and '{source}' … EVAL-CORR moves subfields that share a name between the two structures. When no name is common to both there is nothing to move. Mirrors IBM i RNF7351 ("EVAL-CORR … ignores all subfields"), which also lists the subfields found in only one operand (RNF7341 / RNF7342). Check the subfield spellings. Note that qualifying a structure does not by itself help - what matters is that the two structures share subfield names.
TRN2111 Invalid SND-MSG message type '{type}'; expected *INFO, *ESCAPE, … The message type is not one of the values SND-MSG accepts. Use one of the listed types, or omit the type to take the *INFO default.
TRN2112 Undefined procedure '{name}' (no matching DCL-PR found) CALLP names a procedure with no prototype. A prototype declared later in the module resolves normally, so this fires only when none exists. Add a DCL-PR for the procedure, or correct the name.
TRN2113 Undefined subroutine '{name}' (no matching BEGSR found) EXSR names a subroutine with no BEGSR. A subroutine defined later in the source resolves normally. Add the BEGSR/ENDSR block, or correct the name.
TRN2114 NEXT '{file}' must reference a WORKSTN file … NEXT selects the program device for the next read of a multiple-device file, so it applies only to a WORKSTN file. Name a declared WORKSTN file, or remove the NEXT.
TRN2115 READC '{format}' references a non-subfile format … READC reads changed subfile records, so its format must carry the DDS SFL keyword. Name the subfile record format, not the subfile-control format.
TRN2116 READC '{format}' requires the SFILE keyword on the declaration of '{file}' … The subfile's relative-record-number field comes from SFILE(format:rrn) on the DCL-F. Mirrors IBM i RNF5190. Add SFILE({format}:<rrn-variable>) to the file declaration.
TRN2117 {opcode} '{name}' does not reference a known file or record format A record-level operation names neither a declared file nor any of its record formats. Raised for READP, CHAIN, SETLL, SETGT, READE and READPE; either spelling - the file name or one of its formats - is accepted. A format moved aside by RENAME(external:internal) is reachable only by its internal name afterwards, so naming the external one lands here. IBM reports the same source as RNF7030 at severity 30. Correct the name, or use the internal name a RENAME established.
TRN2118 UPDATE references unknown format '{format}' … The UPDATE format is neither a disk record format nor a declared display-file format. Mirrors IBM i RNF5189. Correct the format name, or declare the file that defines it.
TRN2119 UPDATE '{format}' references a non-subfile format … UPDATE on a WORKSTN file rewrites a subfile record, so the format must carry SFL. Mirrors IBM i RNF5189. Name the subfile record format.
TRN2120 UPDATE '{format}' requires the SFILE keyword on the declaration of '{file}' … As TRN2116, for UPDATE. Mirrors IBM i RNF5190. Add SFILE({format}:<rrn-variable>) to the file declaration.
TRN2121 Undefined host variable ':{name}' in EXEC SQL statement An embedded-SQL host variable names no declared field. A field declared later in the module resolves normally. Declare the field, or correct the name.
TRN2122 Host variable ':{name}' has type {type} which is not SQL-compatible The host variable's type has no SQL equivalent (for example a pointer). A data structure is accepted as a host structure and does not raise this. Use a scalar of an SQL-compatible type, or a data structure whose subfields are.
TRN2123 Length adjustment of {kind} field '{name}' is not allowed LIKE(name : ±n) adjusts a length, which is meaningful only for types that have one. Mirrors IBM i RNF3356. Drop the adjustment, or apply it to a character or numeric field.
TRN2124 LIKE adjustment on '{name}' produces an invalid integer size of {n} digits … An integer field must be 3, 5, 10 or 20 digits; the adjustment produced something else. Choose an adjustment that lands on a valid size, or declare the field explicitly.
TRN2125 The procedure interface for '{name}' declares {n} parameter(s) but its prototype declares {m} DCL-PI and DCL-PR must agree: the prototype is the contract callers compile against, the interface is what the body receives. Make the two agree in parameter count.
TRN2126 Parameter {n} of procedure '{name}' does not match the prototype … The interface and prototype disagree on a parameter's type at that position. Parameters are matched by position, not by name. Make the two agree in type at that position.
TRN2127 SUBDUR Factor 1 '{operand}' must be a date, time, or timestamp The duration form of SUBDUR computes the difference between two date/time values. Use a date, time or timestamp operand.
TRN2128 SUBDUR Factor 2 '{operand}' must be a date, time, or timestamp As TRN2127, for Factor 2. Use a date, time or timestamp operand.
TRN2129 SUBDUR operands '{a}' and '{b}' are not compatible … The two operands are not of comparable kinds - a date cannot be subtracted from a time. A timestamp may be paired with either. Use two operands of the same kind, or pair one with a timestamp.
TRN2130 SUBDUR duration code '{code}' is not valid for a {unit} difference The duration code does not apply to the operands' kind - for example asking for a time unit from a date difference. Use a duration code valid for the operand kind.
TRN2131 {opcode} '{format}' used but no display file is declared (DCL-F) A screen operation names a format, but the program declares no WORKSTN file. This does not fire for a printer record format - those route to the printer path. Declare the display file, or correct the operation.
TRN2132 {opcode} references unknown format '{format}' - not found in any declared display file The format name appears in no declared display file. Correct the format name, or supply the .dspf that defines it.
TRN2133 Externally-described file {name} has no available layout … rpgc could not find the external description for the file. This is a build-configuration error rather than a source defect: on IBM i the compiler reads the layout from the file object on the system, which rpgc cannot do, so the description must be supplied locally. Supply the description under --dds-path - .pf for a physical file, .prtf for a printer file, .dspf for a display file - or configure a catalog resolver.
TRN2134 {bif} requires {n} argument(s) but got {m} The built-in function was called with the wrong number of arguments. Check the BIF's signature; some take an optional trailing argument.
TRN2135 Undefined variable '{name}' The name resolves to no declared field, constant, or subfield. A field declared later in the module resolves normally, so this fires only when the name is genuinely absent - most often a typo, or a /COPY member that did not resolve. Declare the field, correct the spelling, or check that the /COPY providing it was found.
TRN2136 Undefined qualified field '{ds}.{field}' The dotted path names no subfield of that structure. Mirrors IBM i RNF5403. Also reported when such a path is named as a BASED(...) basing pointer. Check the subfield name, and that the structure is the one you meant.
TRN2137 Undefined internal procedure '{name}' A call names an internal procedure that the module does not define. Define the procedure, or correct the name.
TRN2138 {opcode} '{format}' requires a display file that can be read from / written to, but '{file}' is declared input-only / output-only A screen operation is used against a display file whose declared I/O direction does not permit it. EXFMT needs both directions, READ and READC need input, and WRITE needs output. The direction comes from USAGE on a free-format DCL-F, or from the file-type column of a fixed-format WORKSTN F-spec (17 in RPG IV, 15 in the classic map). A display file declared with no USAGE keyword is combined and permits every operation, so ordinary display files are unaffected. IBM rejects the same combinations at severity 30 and creates no program object, so this is an error rather than a warning. Declare the direction the operations need - drop the USAGE keyword for a combined file, or use USAGE(*INPUT : *OUTPUT) - or use the operation that matches the direction the file really has.
TRN2139 Length-prefix width {n} on varying field '{name}' is not valid - only 2 or 4 are allowed; the default 2-byte prefix takes effect A varying field's length prefix may be 2 or 4 bytes and nothing else. The width comes from the second argument of VARCHAR(n : w) / VARGRAPH(n : w) / VARUCS2(n : w), or from the VARYING(w) keyword in either format. Any other value is not rejected - IBM warns (RNF3561, severity 20) and creates the program with the default 2-byte prefix, and rpgc does the same, so %SIZE is unchanged by the mistake. The warning exists because the declared width would otherwise be lost silently: a field written VARCHAR(5 : 3) occupies 7 bytes, not 8. A bare VARYING with no width names none and is correct. Write 2 or 4, or drop the width to take the default.
TRN2140 The {ordinal} parameter of {%BIF} is not valid - it must be a character value; convert it explicitly with %CHAR, %EDITC or %EDITW A character built-in was given an argument that cannot be a character value - a date, time, timestamp, zoned or float. Applies to %TRIM/%TRIML/%TRIMR, %SUBST, %XLATE, %SCAN, %SCANRPL, %REPLACE and %CHECK/%CHECKR, on whichever of their parameters is character (a %SUBST start and length are numeric and are not checked here). IBM rejects the same source - RNF0371 for %TRIM, RNF0361 for %SUBST, RNF0577 for %XLATE - at severity 20. Wrap the argument in %CHAR, %EDITC or %EDITW.
TRN2141 Operands are not compatible with a concatenation - a {kind} value cannot be concatenated with a character value; convert it explicitly with %CHAR, %EDITC or %EDITW A + with a character operand is a concatenation, and the other operand is a date, time, timestamp, zoned or float, which has no character form to join. IBM reports the same source as RNF7421 ("Operands are not compatible with the type of operation"). Convert the non-character operand with %CHAR, %EDITC or %EDITW.
TRN2142 (warning) Record format '{format}' named on IGNORE is not a format of file '{file}' IGNORE names a record format the file does not define. It is a warning, not an error, because the formats the file does define are still selected and the program is still buildable - IBM reports RNF2092 at severity 20. Correct the format name, or drop the IGNORE.
TRN2143 (warning) Record format '{format}' named on INCLUDE is not a format of file '{file}' INCLUDE names a record format the file does not define. Mirrors IBM i RNF2425, severity 20. On its own this is a warning, but because INCLUDE selects only the formats it names, naming a format that is not there usually leaves nothing selected and TRN2145 follows. Correct the format name, or drop the INCLUDE.
TRN2144 (warning) INCLUDE is not allowed with IGNORE on file '{file}'; the INCLUDE is ignored and IGNORE is applied Both keywords are written on one file. They are alternative ways of saying the same thing, so IBM does not treat this as fatal: IBM reports RNF2424 at severity 20. rpgc resolves it the same way. Keep whichever keyword expresses the intent and remove the other.
TRN2145 Every record format of file '{file}' is ignored or not selected, so the file defines nothing the program can reference After IGNORE and INCLUDE are applied, no record format of the file is left. The file then contributes no fields and no format name, so every reference to one is undefined. Mirrors IBM i RNF2109, which IBM issues at severity 40 - enough to stop program creation outright. Leave at least one format selected: remove it from the IGNORE list, or add it to the INCLUDE list.
TRN2146 {keyword} on {where} names an unknown format '{word}'; valid {kind} formats are {list} A DATFMT or TIMFMT word does not name a format, or names a format that is not allowed in this context. The valid words differ by kind - *MDY is a date format and not a time format, *HMS the reverse - and by context: a field declaration accepts a narrower set than a conversion. Mirrors IBM i RNF0612 (unknown format) and RNF0617 (format not allowed on DATFMT), both severity 20. Use a format valid for the context. On a field declaration, dates: *MDY *DMY *YMD *JUL *ISO *USA *EUR *JIS *MDYY *DMYY *YYMD. In a conversion (%CHAR, %DATE, MOVE factor 1), the century formats (*CYMD *CMDY *CDMY), *LONGJUL, and *LONGJOBRUN are also accepted. Times: *HMS *ISO *USA *EUR *JIS. A separator suffix such as *MDY- is allowed where the format accepts that separator.
TRN2147 {mode} is the character-counting mode of {%BIF} and may only be written as its last argument The *NATURAL / *STDCHARSIZE argument of a string built-in is misplaced. The mode is appended after the built-in's other arguments, so a mode word written earlier is sitting in a slot that holds a real operand - in %TRIM(s : *NATURAL : x) it occupies the characters-to-trim argument. Move the mode to the end of the argument list.
TRN2148 REQPROTO(...) on {where} is not valid; the only value it takes is *NO / REQPROTO is not valid on a subprocedure's procedure interface / REQPROTO is not valid on a prototype REQPROTO is written with a value it does not take, or in a position it is not permitted. The only value is *NO, and the parameter is mandatory - IBM reports a wrong value as RNF1527 and a missing one as RNF0603, both severity 20. The permitted positions are narrower than "a definition keyword and a procedure keyword" suggests: DCL-PROC, the fixed-format P-spec keyword area, and the cycle-main procedure interface (a DCL-PI at file scope in a program with no MAIN()). It is not valid on a subprocedure's own DCL-PI (IBM: RNF3588), on a linear-main procedure's DCL-PI (RNF3841), or on a DCL-PR prototype (RNF3749). Write REQPROTO(*NO), and put it on the DCL-PROC (or P-spec) of the procedure being defined, or on the cycle-main interface.
TRN2149 INFDS subfield '{name}' at position {pos} of file '{file}' is not supported - this feedback position is not populated by the compiler A disk-file INFDS declares a feedback subfield at a byte position the compiler does not populate after I/O - anything outside the file name (1), open and end-of-file indicators (9, 10), *STATUS (11), *OPCODE (16), and the record-format name (261). IBM i refreshes the other feedback positions (for example *ROUTINE, the error message id, or the relative record number) after each operation. Because INFDS is read by the program to make decisions, leaving a subfield at blanks/zeros would silently change program behavior, so the compile is rejected rather than allowed to proceed with wrong feedback values. Remove the unsupported subfield, or read the feedback value through one of the supported positions.
TRN2150 Prototype '{name}' names a bound procedure, which the default activation group cannot call; specify DFTACTGRP(*NO) - or give the prototype EXTPGM(...) if it names a program rather than a procedure A prototype that names no external program describes a bound procedure call, and the default activation group cannot host one. IBM rejects the combination outright - RNF3788, severity 30, no program object - so accepting it would let you write source here that cannot be built on IBM i at all. The rule turns on EXTPGM and nothing else: a prototype with EXTPGM is a dynamic program call and is perfectly valid under DFTACTGRP(*YES). Only this combination is an error. Change the control option to DFTACTGRP(*NO) (with an ACTGRP), or add EXTPGM('PGMNAME') to the prototype if it really names a program.
TRN2151 The device keyword parameter '{parameter}' on file '{file}' must be *EXT or a record length A free-form device keyword - DISK, PRINTER or WORKSTN - carries a parameter that is neither *EXT nor a record length. *EXT states the externally described default explicitly; a number makes the file program-described with that record length. IBM reports anything else as RNF2366 at severity 20. Write *EXT for an externally described file, or the record length for a program-described one.
TRN2152 Record length {length} on file '{file}' is not valid - a program-described file must state a length from 1 to 32766 A program-described file states a record length outside the accepted range. The bound applies wherever the length is written: the parameter on a free-form device keyword (DISK(80)), or columns 23-27 of a fixed-format F-spec. IBM reports an out-of-range length as RNF2007 at severity 20 in both formats. State a record length from 1 to 32766, or drop the length entirely (and use *EXT in free form) for an externally described file.
TRN2154 {opcode} on program-described WORKSTN file '{name}' is not supported - screen I/O requires an externally-described WORKSTN file WRITE and READ on a program-described WORKSTN file with a data-structure result field are rejected. Only externally-described WORKSTN files support screen I/O. The declaration itself is accepted. See also TRN2159, which covers the EXFMT case. Use an externally-described WORKSTN file (DCL-F name WORKSTN with a .dspf DDS file supplied via --dds-path).
TRN2155 Bound procedure '{name}' is not resolved - no service module on the classpath or binding directory exports it A prototype with EXTPROC (or an implicit bound-call prototype) names a procedure that could not be found in any service module on the classpath or binding directory. rpgc bridges the most commonly used QC2LE procedures (getenv, system, printf) to JVM equivalents - those names never trigger this warning. For other unresolved names, the program compiles but the call will fail at runtime with ClassNotFoundException. Warning. Supply the service module via --classpath or --bnddir.
TRN2156 No candidate in OVERLOAD(...) for prototype '{name}' matches the argument types at this call site A call to an overloaded prototype could not be resolved - none of the candidate procedures listed in the OVERLOAD(proc1:proc2:...) keyword accept the argument types provided at the call site. Verify the argument types match one of the candidate prototypes. Check that the variable being passed has the expected data type.
TRN2157 Ambiguous call to overloaded prototype '{name}' - candidates {list} all match the argument types A call to an overloaded prototype matched more than one candidate procedure. The candidates listed in OVERLOAD(...) must be truly unique - no two candidates may accept the same argument types. Ensure each candidate prototype has a distinct parameter signature. Use OPTIONS(*EXACT) on parameters or vary the parameter count to make candidates unambiguous.
TRN2158 Unrecognized SQLTYPE name '{name}' The SQLTYPE keyword names a type the IBM SQL precompiler does not recognize. IBM rejects these with SQL0104. Valid names are CLOB, BLOB, DBCLOB, RESULT_SET_LOCATOR, ROWID, BINARY, VARBINARY, and their _FILE / _LOCATOR / XML_ variants. Warning. Use one of the recognized SQLTYPE names listed in the message.
TRN2159 EXFMT on program-described WORKSTN file '{name}' is not valid - EXFMT requires a named record format from an externally-described display file EXFMT requires a named record format, which a program-described WORKSTN file does not have. IBM i rejects the same source with RNF7260 at severity 30. Unlike WRITE and READ (see TRN2154), EXFMT is never valid for a program-described file. Use an externally-described WORKSTN file with a .dspf DDS file, or replace the EXFMT with separate WRITE and READ operations (see TRN2154).