Using Input Specifications to Modify an External Description
For a global unqualified file, you can use the input specifications
to override certain information in the external description of an input
file or to add RPG functions to the external description. On the input specifications,
you can:
Assign record-identifying indicators to record formats as shown in Figure 160.
You cannot use the input specifications to override field locations in
an externally described file. The fields in an externally described file are
placed in the records in the order in which they are listed in the data description
specifications. Also, device-dependent functions such as forms control, are
not valid in an RPG program for externally described files.
Note:
You can explicitly rename a field on an input specification, even when the
PREFIX keyword is specified for a file. The compiler will recognize (and require)
the name that is first used in your program. For example,
if you specify the prefixed name on an input specification to associate the
field with an indicator, and you then try to rename the field referencing
the unprefixed name, you will get an error. Conversely, if you first rename
the field to something other than the prefixed name, and you then use the
prefixed name on a specification, you will get an error.
Figure 160. Overriding and Adding RPG Functions to an External Description
To assign a record-identifying indicator to a record in an externally
described file, specify the record-format name in positions 7 through 16 of
the input specifications and assign a valid record-identifying indicator in
positions 21 and 22. A typical use of input specifications with externally
described files is to assign record-identifying indicators.
In this example,
record-identifying indicator 01 is assigned to the record MSTRITEM and indicator
02 to the record MSTRWHSE.
2
To rename a field in an externally described record, specify the external
name of the field, left-adjusted, in positions 21 through 30 of the field-description
line. In positions 49 through 62, specify the name that is to be used in the
program.
In this example, the field ITEMNUMB in both records is renamed
ITEM for this program.
3
To assign a control-level indicator to a field in an externally described
record, specify the name of the field in positions 49 through 62 and specify
a control-level indicator in positions 63 and 64.
In this example, the
ITEM field in both records MSTRITEM and MSTRWHSE is specified to be the L1
control field.
Figure 161. Adding RPG Functions to an External Description
To assign a match value to a field in an externally described record,
specify the record-format name in positions 7 through 16 of the record-identification
line. On the field-description line specify the name of the field in positions
49 through 62 and assign a match-level value in positions 65 and 66.
In
this example, the CUSTNO field in both records MSTREC and WKREC is assigned
the match-level value M1.
2
To assign a field indicator to a field in an externally described record,
specify the record-format name in positions 7 through 16 of the record-identification
line. On the field-description line, specify the field name in positions 49
through 62, and specify an indicator in positions 69 through 74.
In this
example, the field BALDUE in the record WKREC is tested for zero when it is
read into the program. If the field’s value is zero, indicator 98 is set
on.