IBM AS/400 Frozen Dessert Maker User Manual


 
Types of File Descriptions
Less maintenance activity when the file’s record format is changed. You can
often update programs by changing the file’s record format and then recom-
piling the programs that use the files without changing any coding in the
program.
Improved documentation because programs using the same files use consistent
record-format and field names.
Improved reliability. If level checking is specified, the RPG program will notify
the user if there are changes in the external description. See “Level Checking”
on page 270 for further information.
If an externally described file (identified by an E in position 22 of the file description
specification) is specified for the devices SEQ or SPECIAL, the RPG program uses
the field descriptions for the file, but the interface to the operating system is as
though the file were a program-described file. Externally described files cannot
specify device-dependent functions such as forms control for PRINTER files
because this information is already defined in the external description.
Using Files with External-Description as Program-Described
A file created from external descriptions can be used as a program-described file in
the program. To use an externally described file as a program-described file,
1. Specify the file as program-described (F in position 22) in the file description
specification of the program.
2. Describe the fields in the records on the input or/and output specifications of
the program.
At compile time, the compiler uses the field descriptions in the input or/and output
specifications. It does not retrieve the external descriptions.
Example of Some Typical Relationships between Programs and Files
Field-Level
Description of
a File
Record-Level
Description of
a File
OS/400
RPG RPG RPG RPG
OS/400 OS/400
Field-Level
Description of
a File
Externally
Described File
(E in position 22)
Program-Described
File (F in position
22) - The compiler
does not copy in
field-level description
Program-Described
File (F in position 22)
Externally
Described File
(E in position 22)
1 2 3 4
Figure 129. Typical Relationships between an RPG Program and Files on the AS/400 System
1 The program uses the field-level description of a file that is defined to
the operating system. An externally described file is identified by an E in
position 22 of the file description specifications. At compilation time, the
compiler copies in the external field-level description.
264 ILE RPG for AS/400 Programmer's Guide