COBOL Manual for TNS and TNS/R Programs
Data Division
HP COBOL Manual for TNS and TNS/R Programs—522555-006
7-5
File Description Entries
01-data-description
defines a logical record, specifying the layout of fields within the record and the
size and usage of each field. See Data Description Entries.
Topics:
•
File Description Entries
•
Sort-Merge File Description Entries
•
Data Description Entries
File Description Entries
The file description (FD) entry is the highest level of organization in the File Section of
the Data Division. FD clauses give the size of logical and physical records and the
names and attributes of the data records within the file. When a file is to be printed on
a printer (either directly, or through a spooler), its file description can include
information about how the data is printed on a page.
The characteristics of the file determine which of the clauses are required and which
are optional. Clauses that appear can follow in any order, ending with a period after the
last clause. No clause can appear more than once. The data description entries of one
or more records must follow the file description entry.
Each file description entry must be followed by one or more record description entries.
These describe the format or formats of the logical records in the file. When more than
one record description entry appears, they can describe record images of different
lengths and substructures. All record description entries associated with a single file
represent implicit redefinitions of the file’s record area. The file name in the file
description entry can be used as the final qualifier in references to its record items,
their subordinate data items, or condition-names associated with any of these.
When more than one of the source programs compiled into a run unit includes a file
description entry defining the same external file name, all of these descriptions must
specify the same block size convention, character code convention, labeling
convention, linage attributes, and record attributes. For details, see EXTERNAL
Clause.
The file description entry describes the logical characteristics of a data file.
The record description entries associated with a file description entry define the
possible formats of the logical records for that file. Although different record
descriptions define different types of logical records from the perspective of the source
program, the corresponding logical records in the file might not have different
representations. Conceptually, every record description applies to every logical record
in the file; therefore, when the file actually contains different types of logical records, it
is your responsibility to code the program such that it determines which of the record
descriptions are appropriate for each particular record.