HP OpenVMS Systems Documentation
identification-divisionrepresents a COBOL Identification Division.
environment-divisionrepresents a COBOL Environment Division.
data-divisionrepresents a COBOL Data Division.
procedure-divisionrepresents a COBOL Procedure Division.
source-programrepresents a contained (nested) COBOL source program. A COBOL source program may be nested; more than one source program may be present in a single source file.
end-program-headerrepresents a COBOL END PROGRAM header.
The end-program-header must be present if either:
Figure 2-1 shows the basic structure of a COBOL program, which is organized in divisions, sections, paragraphs, sentences, and entries.
Figure 2-1 Structure of a COBOL Program
IDENTIFICATION DIVISION. PROGRAM-ID. program-name. AUTHOR. INSTALLATION. DATE-WRITTEN. DATE-COMPILED. SECURITY. OPTIONS. ENVIRONMENT DIVISION. CONFIGURATION SECTION. SOURCE-COMPUTER. OBJECT-COMPUTER. SPECIAL-NAMES. INPUT-OUTPUT SECTION. FILE-CONTROL. I-O-CONTROL. DATA DIVISION. SUBSCHEMA SECTION. subschema entries and keeplist entries FILE SECTION. file and record description entries report file description entries sort-merge file and record description entries WORKING-STORAGE SECTION. record description entries LINKAGE SECTION. record description entries REPORT SECTION. report and report group description entries. SCREEN SECTION. (Alpha, I64) screen description entries (Alpha, I64) PROCEDURE DIVISION. DECLARATIVES. sections paragraphs sentences END DECLARATIVES. . . . sections paragraphs sentences . . . END PROGRAM header
Except for the COPY and REPLACE statements, and the END PROGRAM header (see Section 6.9 in Chapter 6), the statements, entries, paragraphs, and sections of a COBOL source program are grouped into four divisions in this order:
The end of a COBOL source program is indicated either by the END PROGRAM header ( Section 6.9) or by the end of that program's Procedure Division.
Only these items can immediately follow a division header:
Only this item can immediately follow a DECLARATIVES header:
The PROCEDURE DIVISION header can contain a USING and GIVING phrase. (See Section 6.8.)
A section header identifies and marks the beginning of a section in the Environment, Data, and Procedure Divisions. In the Environment and Data Divisions, a section header is a specific combination of reserved words followed by a separator period. In the Procedure Division, a section header is a user-defined word followed by the word SECTION (and an optional segment-number). A separator period always follows a section header. Section headers start in Area A.
The valid section headers follow for each division.
In the Environment Division:
In the Data Division:
SCREEN SECTION. (Alpha, I64)
In the Procedure Division:
user-name SECTION [ segment-number ].
Only these items can immediately follow a section header:
The paragraph headers are as follows:
A paragraph-name is a user-defined word followed by a separator period. Paragraph-names identify paragraphs in the Procedure Division.
Paragraph headers and paragraph-names start in Area A of any line after the first line of a division or section.
The first entry or sentence of a paragraph begins either:
Successive sentences or entries begin in Area B of either:
The level indicators are as follows:
Level indicators can begin anywhere to the right of Area A.
Entries that begin with level-numbers are called either data description or screen description entries, depending on their context. The level-number values are 01 to 49, 66, 77, and 88 for data description items and 01 to 49 for screen description entries. Level-numbers 01 to 09 can be represented as one- or two-digit numbers.