Defining Externally Described Files
The external description for a file includes:
- The record format specifications that contain a
description of the fields in a record
- Access path specifications that describe how the
records are to be retrieved.
These specifications come from the external file description and from the OS/400 command
you use to create the file.
Externally described files offer the following advantages over program-described
files:
- Less coding in ILE COBOL programs. If the same file is used by many programs,
the fields can be defined once to the operating system, and then used by all
the programs. This eliminates the need to code a separate record description
for each program that uses the file.
- Reduces the chance of programming error. You can often update programs
by changing the file's record format and then recompiling the programs
that use the file without changing any coding in the program.
- Level checking of the file description. A level check of the description
of the file in the ILE COBOL program and the actual file on the system is performed
when the file is opened (unless LVLCHK(*NO) is specified on the create file
command or an override command). If the description of the file in the program
does not match the actual file, the open operation will fail with a file status
of 39.
- For indexed files, if EXTERNALLY-DESCRIBED-KEY is specified in the RECORD
KEY clause, you can ensure that the record key occupies the same position
in the actual file as in your ILE COBOL program's description of the file. Also,
you can use noncontiguous keys, which is not possible with program-described
files.
- Improved documentation. Programs using the same files use consistent record
format and field names.
- Any editing to be processed on externally described output files can be
specified in DDS.
Before you can use an externally described file in your program, you must
create a DDS to describe the file and create the actual file itself.
(C) Copyright IBM Corporation 1992, 2006. All Rights Reserved.