Data Division in COBOL - Concept Explained
The DATA DIVISION is that part of the COBOL program where every data item processed by the program is described.
It is important to note that, unless an item is described in the DATA DIVISION it cannot be used in the PROCEDURE DIVISION.
DATA DIVISION consists of various sections:
1) FILE SECTION: This includes the descriptions of all the data items that should be read from or written onto some external file.
2) WORKING-STORAGE SECTION: The data items which are developed internally as intermediate results as well as the constants are described in this section.
The format is as follows:
DATA DIVISION.
FILE SECTION.
...................................
....[file section entries]...
...................................
WORKING-STORAGE SECTION.
..........................................
....[working storage entries]...
..........................................
All the section names as well as the division name must be coded as margin A entries.
Both these sections are optional i.e. a particular section may be omitted if there is no data that may be described.