COBOL Data Division
The Data Division is optional, but usually present. It describes the format in which data is input, stored, and/or output.
The FILE SECTION concerns the format of records and data of computer files. It can include level 88 entries, which specify in advance the value or range of values that a variable can hold, if this is known in advance of running the program. This can be used to test the data.
The WORKING-STORAGE section describes the format of records and data held locally by the program during processing. It can include individual fields holding temporary data. The data is held in the computer memory.
The LINKAGE section is for data passed between the different programs of an application.
The REPORT section gives the layouts of reports produced by the program.
|
|
1 |
2 3 4 5 6 7 |
8 |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
123456 |
7 |
8901 |
23456789012345678901234567890123456789012345678901234567890123 |
34567890 |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Seq. | - | A | B | Ident | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
DATA | DIVISION. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
FILE | SECTION. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
FD | filename RECORDING [MODE IS] {F|V|U} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
[BLOCK [CONTAINS] integer {CHARACTERS|RECORDS}] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
[RECORD [CONTAINS] [integer TO] integer CHARACTERS] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
LABEL {RECORD[S] [(IS|ARE)]} { STANDARD|OMITTED|data_name} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
DATA {RECORD[S] [(IS|ARE)]} list_of_record_names | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
plus record description entries as shown below. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
SD | sort_filename | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
[RECORD [CONTAINS] [integer TO] integer CHARACTERS] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
RECORDING [MODE IS] {F|V|U} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
plus record description entries as shown below. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
WORK | ING-STORAGE SECTION. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
All record description entries as shown below plus: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
VALUE [IS] literal | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
LINK | AGE SECTION. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Record description entries as for FILE SECTION etc. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
REPO | RT SECTION. | F only. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
RD | report_filename [CODE 'any character'] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
[{CONTROL[S] [(IS|ARE)]} [FINAL][list_of_data_names]] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
[PAGE integer [LINES][HEADING integer][FIRST DETAIL integer] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
[LAST DETAIL integer][FOOTING integer] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
01 report_group_name | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
[LINE {integer|PLUS integer|NEXT PAGE}] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
[NEXT GROUP {integer|PLUS integer|NEXT PAGE}] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
type TYPE_INDICATOR. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Levels other than 01: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
nn data_name | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
[LINE {integer|PLUS integer|NEXT PAGE}] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
[COLUMN integer][GROUP INDICATE] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
[RESET [ON] {data_name|FINAL}] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
[PICTUE [IS] picture] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
[[{SOURCE data_name|SUM list_of_datanames [UPON data_name] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|Value [IS] literal}] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
[BLANK [WHEN] ZERO][JUSTIFIED RIGHT] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Record description entries:
|
|
1 |
2 3 4 5 6 7 |
8 |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
123456 |
7 |
8901 |
23456789012345678901234567890123456789012345678901234567890123 |
34567890 |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Seq. | - | A | B | Ident | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
01 record_name | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
02 {data_name|FILLER} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
[REDEFINES data_name]
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
[PICTURE [IS] picture] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
[USAGE [IS] {DISPLAY|COMPUTATIONAL|COMPUTATIONAL-1|
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
COMPUTATIONAL-2|COMPUTATIONAL-3]
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
[OCCURS integer [TIMES] [DEPENDING [ON] data_name]] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
[BLANK [WHEN] ZERO] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
[JUSTIFIED RIGHT] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
[VALUE [IS] literal] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
[ ] denotes an optional element within a statement.
Level 88 occurs only in FILE SECTION.
