DATA DIVISION overview

This overview describes the structure of the DATA DIVISION for programs, object definitions, factory definitions, and methods.

Each section in the DATA DIVISION has a specific logical function within a COBOL program, object definition, factory definition, or method and can be omitted when that logical function is not needed. If included, the sections must be written in the order shown. The DATA DIVISION is optional.

Program data division
The DATA DIVISION of a COBOL source program describes, in a structured manner, all the data to be processed by the program.
Object data division
The object data division contains data description entries for instance object data (instance data). Instance data is defined in the WORKING-STORAGE SECTION of the object paragraph of a class definition.
Factory data division
The factory data division contains data description entries for factory object data (factory data). Factory data is defined in the WORKING-STORAGE SECTION of the factory paragraph of a class definition.
Method data division
A method data division contains data description entries for data accessible within the method. A method data division can contain a LOCAL-STORAGE SECTION or a WORKING-STORAGE SECTION, or both. The term method data applies to both. Method data in LOCAL-STORAGE is dynamically allocated and initialized on each invocation of the method; method data in WORKING-STORAGE is static and persists across invocations of the method.
Start of changeUser-defined function data divisionEnd of change
Start of changeThe DATA DIVISION of a user-defined function describes, in a structured manner, all the data to be processed by the function.End of change
Start of changeFunction prototype data divisionEnd of change
Start of changeThe function prototype data division contains data description entries in the LINKAGE SECTION that describe the parameters and returning item of the function. End of change

Format: program and method data division

Read syntax diagramSkip visual syntax diagramDATA DIVISION.FILE SECTION.file-description-entryrecord-description-entryWORKING-STORAGE SECTION.record-description-entrydata-item-description-entryLOCAL-STORAGE SECTION.record-description-entrydata-item-description-entryLINKAGE SECTION.record-description-entrydata-item-description-entry

Format: object and factory data division

Read syntax diagramSkip visual syntax diagramDATA DIVISION.WORKING-STORAGE SECTION.record-description-entrydata-item-description-entry

Format: function prototype data division

Read syntax diagramSkip visual syntax diagramDATA DIVISION.LINKAGE SECTION.record-description-entrydata-item-description-entry