IBM AS/400 Frozen Dessert Maker User Manual


 
Types of File Descriptions
RPG program
FILEY
File name - FILEY
Device = SEQ
Device type =
PRINTER
File type =
DEVICE
Figure 128. Associating a file name with a display file description
Although the file name and file type are coded in the RPG program, in many cases
you can change the type of file or the device used in a program without changing
the program. To find out how, see “Overriding and Redirecting File Input and
Output” on page 273.
Naming Files
On the AS/400 system, files are made up of members. These files are organized
into libraries. The convention for naming files is library-name/file-name.
In an ILE RPG program, file names are identified in positions 7 through 16 in file
description specifications. File names can be up to ten characters long and must be
unique.
You do not qualify the file name with a library within a program. At run time, the
system searches the library list associated with your job to find the file. If you wish
to change the name, member, or specify a particular library, you can use a file
override command. See “Overriding and Redirecting File Input and Output” on
page 273 for more information on file overrides.
Types of File Descriptions
When identifying the file description your program will be using, you must indicate
whether it is a program-described file or an externally described file.
For a program-described file, the description of the fields are coded within the
RPG source member on input and/or output specifications.
The description of the file to the operating system includes information about
where the data comes from and the length of the records in the file.
For an externally described file, the compiler retrieves the description of the
fields from an external file-description which was created using DDS, IDDU, or
SQL commands. Therefore, you do not have to code the field descriptions on
input and/or output specifications within the RPG source member.
The external description includes information about where the data comes from,
such as the database or a specific device, and a description of each field and
its attributes. The file must exist and be accessible from the library list before
you compile your program.
Externally described files offer the following advantages:
Less coding in programs. If the same file is used by many programs, the fields
can be defined once to the operating system and used by all the programs.
This practice eliminates the need to code input and output specifications for
RPG programs that use externally described files.
Chapter 14. Defining Files 263