IBM AS/400 Frozen Dessert Maker User Manual


 
Defining Externally Described Files
Renaming Record-Format Names
Many of the functions that you can specify for externally described files (such as
the CHAIN operation) operate on either a file name or a record-format name. Con-
sequently, each file and record-format name in the program must be a unique sym-
bolic name.
To rename a record-format name, use the RENAME keyword on the file description
specifications for the externally described file as shown in Figure 130. The format
is RENAME(
old name
:
new name
).
*.. 1 ...+... 2 ...+... 3 ...+... 4 ...+... 5 ...+... 6 ...+... 7 ...+... *
FFilename++IPEASFRlen+LKlen+AIDevice+.Keywords+++++++++++++++++++++++++++++
FITMMSTL IP E K DISK RENAME(ITEMFORMAT:MSTITM)
*
Figure 130. RENAME Keyword for Record Format Names in an Externally Described File
The RENAME keyword is generally used if the program contains two files which
have the same record-format names. In Figure 130, the record format
ITEMFORMAT in the externally described file ITMMSTL is renamed MSTITM for
use in this program.
Renaming Field Names
You can partially rename all fields in an externally described file by using the
PREFIX keyword on the file-description specification for the file. You can either
add a prefix to the existing field name or you can replace part of the existing field
name with a sequence of characters. The format is PREFIX(
prefix-string
:
{
nbr_of_char_replaced}
). Figure 131 shows some examples of the use of PREFIX.
*.. 1 ...+... 2 ...+... 3 ...+... 4 ...+... 5 ...+... 6 ...+... 7 ...+... *
FFilename++IPEASFRlen+LKlen+AIDevice+.Keywords+++++++++++++++++++++++++++++
* Add the prefix MST to each name in the record format
FITMMSTL IP E K DISK PREFIX(MST)
*
* Change the prefix YTD to YE for each name in the record format
FSALESMSTR IP E K DISK PREFIX(YE:3)
Figure 131. Prefix Keyword for Record Format Names in an Externally Described File
Ignoring Record Formats
If a record format in an externally described file is not to be used in a program, you
can use the IGNORE keyword to make the program run as if the record format did
not exist in the file. For logical files, this means that all data associated with that
format is inaccessible to the program. Use the IGNORE keyword on a file
description specifications for the externally described file as shown in Figure 132
on page 267.
The file must have more than one record format, and not all of them can be
ignored; at least one must remain. Except for that requirement, any number of
record formats can be ignored for a file.
266 ILE RPG for AS/400 Programmer's Guide