The DATA DIVISION defines the names that the program will use to refer to the data that it manipulates. It must begin with the phrase
It can have the following sections, which, if present at all must appear in the given order.
Every file selected in the INPUT-OUTPUT SECTION of the ENVIRONMENT DIVISION must have at least one corresponding entry in the FILE SECTION. The format for an input or output file is as follows: Parts in [ ] are optional.
It is usual to follow this by the definition of the data record. For a sort file the label FD is replaced by SD.
The format for the data record is a follows. (More details on this are in the WORKING STORAGE SECTION material below.)
The actual names and numbers (other than 01) will vary.
You are remined that this is only a summary for complete details
you should see your text book.
A data item may be indivisible.
In this case it has a level number and a picture clause.
Address thus has 70 characters. Note that any item that is refined at a
higher level number does not have a picture clause. (But check in the book
on the redefines clause.) FILLER is a generic name for area
within a record that will not be referred to by the program.
Every pice of data must have a picture. This determines the type
of data that it is. Except in the case of a redefinition the picture
clause is associated to the highest level in the field.
There is a distinction between the pictures that are used for input (or
working storage) fields
and those that are used for output fields. The ones used for output fields
can be used to edit the output and do things like suppress leaning zeroes
or replace them by asterisks (for checks).
X, A, and 9 can be used plus:
The WORKING-STORAGE SECTION
Single Field Data Items
Picture Clauses
Input or Working Storage Pictures
Output Pictures
Return to the cobol home page
Jonathan Hodgson
Last Change: 9 January 1998