Role of the data division
All the data involved in the program (input, output, middle) are defined here, and their properties are described. The following properties are primarily described:
- Data type (numeric/character) and storage format (length)
- Relationships between data items (hierarchy and layer numbers)
- FILE-to-record relationships
Data division can be divided into:
- file section: used to describe the input and output files in the program and the properties of the data items in the record .
- Unit of Work section (Working-storage) : used to describe intermediate data in a program
- Join section linkage: A data item (that is, a parameter) used to describe data passing between the calling program
Structure diagram of the data section
File section
The data format for each input and output file in the program is described here, including:
- File names and properties
- The name of the record included in the file
- Hierarchical relationship of data in each record
- The format of each data item in the record and the size of the memory
Description of the file General format
FD file name (internal file name)
01 Record Name
05 data item 1 PIC ...
05 Data item 2 PIC ...
An FD statement is a file descriptor that describes the properties of a file and a record, such as the record name, format, and length .
All data groups and data items under the FD statement make up a record of the file.
Record Description: The record description begins with a 01-layer number followed by a record name. The data format used to define records, that is, the data type and length of each underlying data item. If the record itself is an elementary item, the record type and length are described after the record name.
Hierarchy Chart of records
Step by step As400-cobol Get started Tutorial 03-Data Department (original)