ILE RPG Programmer's Guide
The following example shows the use of a file override at compilation
time. Assume that you want to use an externally described file for
a TAPE device which does not have field-level description. You must:
- Define a physical file named FMT1 with one record format that
contains the description of each field in the record format. The record
format is defined on the data description specifications (DDS). For
a tape device, the externally described file should contain only one
record format.
- Create the file named FMT1 with a Create Physical File CL command.
- Specify the file name of QTAPE (which is the IBM-supplied device
file name for magnetic tape devices) in the RPG program. This identifies
the file as externally described (indicated by an E in position 22
of the file description specifications), and specifies the device
name SEQ in positions 36 through 42.
- Use an override command–OVRDBF FILE(QTAPE) TOFILE(FMT1)–at
compilation time to override the QTAPE file name and use the FMT1
file name. This command causes the compiler to copy in the external
description of the FMT1 file, which describes the record format to
the RPG compiler.
- Create the RPG program using the CRTBNDRPG command or the CRTPGM
command.
- Call the program at run time. The override to file FMT1 should
not be in effect while the program is running. If the override is
in effect, use the CL command DLTOVR (Delete Override) before calling
the program.
Note:
You may need to use the CL command OVRTAPF
before you call the program to provide information necessary for opening
the tape file.
Figure 164. Redirecting File Input and Output Example
[ Top of Page | Previous Page | Next Page | Contents |
Index ]