Rational Developer for System z
Enterprise COBOL for z/OS, Version 4.1, Language Reference


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.

Read syntax diagramSkip visual syntax diagram
Format: program and method data division

>>-DATA DIVISION.----------------------------------------------->

>--+-----------------------------------------------------------------------------+-->
   |                .----------------------------------------------------------. |   
   |                V                                                          | |   
   '-FILE SECTION.----+------------------------------------------------------+-+-'   
                      |                         .--------------------------. |       
                      |                         V                          | |       
                      '-file-description-entry----record-description-entry-+-'       

>--+---------------------------------------------------------------+-->
   |                           .---------------------------------. |   
   |                           V                                 | |   
   '-WORKING-STORAGE SECTION.----+-----------------------------+-+-'   
                                 +-record-description-entry----+       
                                 '-data-item-description-entry-'       

>--+-------------------------------------------------------------+-->
   |                         .---------------------------------. |   
   |                         V                                 | |   
   '-LOCAL-STORAGE SECTION.----+-----------------------------+-+-'   
                               +-record-description-entry----+       
                               '-data-item-description-entry-'       

>--+-------------------------------------------------------+---><
   |                   .---------------------------------. |   
   |                   V                                 | |   
   '-LINKAGE SECTION.----+-----------------------------+-+-'   
                         +-record-description-entry----+       
                         '-data-item-description-entry-'       

Read syntax diagramSkip visual syntax diagram
Format: object and factory data division

>>-DATA DIVISION.----------------------------------------------->

>--+---------------------------------------------------------------+-><
   |                           .---------------------------------. |   
   |                           V                                 | |   
   '-WORKING-STORAGE SECTION.----+-----------------------------+-+-'   
                                 +-record-description-entry----+       
                                 '-data-item-description-entry-'       


Terms of use | Feedback

This information center is powered by Eclipse technology. (http://www.eclipse.org)