Rational Developer for System z
COBOL for Windows, Version 7.5, Language Reference


File section

The file section must contain a level-indicator for each input and output file:

file-name
Must follow the level indicator (FD or SD), and must be the same as that specified in the associated SELECT clause. file-name must adhere to the rules of formation for a user-defined word; at least one character must be alphabetic. file-name must be unique within this program.

One or more record description entries must follow file-name. When more than one record description entry is specified, each entry implies a redefinition of the same storage area.

The clauses that follow file-name are optional, and they can appear in any order.

FD (formats 1, 2, and 3)
The last clause in the FD entry must be immediately followed by a separator period.
SD (format 4)
An SD entry must be written for each sort or merge file in the program. The last clause in the SD entry must be immediately followed by a separator period.

The following example illustrates the file section entries needed for a sort or merge file:

SD  SORT-FILE.
01  SORT-RECORD  PICTURE X(80).

A record in the file section must be described as an alphanumeric group item, a national group item, or an elementary item of class alphabetic, alphanumeric, DBCS, national, or numeric.

All the record description entries under the file description entry (FD) for an RSD file must be described with the same number of bytes. The following example illustrates the file section for an RSD file with level 01 records that are of a fixed length:

FILE SECTION.
FD an-RSD-file . . . RECORD CONTAINS 80 CHARACTERS.
01 record-1 PIC X(80).
01 record-2.
    02 PIC X(10).
    02 PIC X(70).

Terms of use | Feedback

Copyright IBM Corporation 1996, 2008.
This information center is powered by Eclipse technology. (http://www.eclipse.org)