Supported RPG Features

The IGNORE and INCLUDE keywords on a file declaration control which record formats of an externally described file are imported into the program:

// Exclude specific formats - all others are included
DCL-F CUSTORDLF DISK USAGE(*INPUT) KEYED IGNORE(ORDRREC);

// Include only named formats - all others are excluded
DCL-F CUSTORDLF DISK USAGE(*INPUT) KEYED INCLUDE(CUSTREC);

Multiple format names are separated by colons:

DCL-F MULTIFILE DISK USAGE(*INPUT) KEYED IGNORE(FMT2:FMT3);

Both keywords are also supported in fixed-format F-specs:

     FCUSTORDLF IF   E           K DISK    IGNORE(ORDRREC)
     FCUSTORDLF IF   E           K DISK    INCLUDE(CUSTREC)

A format these keywords exclude is not part of the program at all: its fields are never declared, so a reference to one is an undefined-variable error.

Naming a format the file does not define is diagnosed but not necessarily fatal. IGNORE of an unknown name reports TRN2142 as a warning and carries on, because the file's real formats are still selected. INCLUDE of an unknown name reports TRN2143 - and because INCLUDE selects only the names it lists, it usually also leaves nothing selected, which is the error below.

Leaving no format selected - ignoring every format, or including none that exist - is rejected with TRN2145. The file would contribute no fields and no format name, so nothing in it could be referenced.

Written together, the two keywords are not an error: TRN2144 warns, the INCLUDE is discarded, and the IGNORE is applied.

Scope. A DISK file's record formats are resolved from its .pf, .lf, or SQL DDL source, and IGNORE/INCLUDE select among them - including the diagnostics above. A multi-format logical file (a .lf whose formats each name their own PFILE) is fully supported: every format's fields are in scope, format-qualified I/O routes to that format's own physical file with its key and fields, and a format-less READ/READE/READP/READPE/SETLL/SETGT/CHAIN naming the LF by its file name reads across all formats in merged key order. Mutating operations (WRITE/UPDATE/DELETE) by file name are rejected with TRN1085 - name a record format instead. Neither IGNORE nor INCLUDE is accepted on a WORKSTN declaration.