HP 3000 Manuals

Divisions [ HP COBOL II/XL Reference Manual ] MPE/iX 5.0 Documentation


HP COBOL II/XL Reference Manual

Divisions 

A division is the first level (highest) construct in a COBOL program.
COBOL programs are partitioned into the following four divisions, which
appear in the order listed:

   *   IDENTIFICATION DIVISION: Specifies the program name and other
       items used to uniquely identify the program.  This division is
       required in every COBOL program.
   *   ENVIRONMENT DIVISION: Describes the computer and peripheral
       devices used to compile and execute the program, and the data
       files used by the program.    This division is optional. 
   *   DATA DIVISION: Describes and defines the data items referenced by
       the program, including their names, lengths, decimal point
       locations (if applicable), and storage formats.    This division 
       is optional. 
   *   PROCEDURE DIVISION: Specifies the operations that the program must
       perform, describing how the data defined in the DATA DIVISION
       should be processed.    This division is optional. 

More information about the functions of these divisions appears later in
this manual, where the divisions are described individually.

Division Format 

Each division begins with a header entry, which is sometimes followed by
one or more sections (in the ENVIRONMENT, DATA, and PROCEDURE DIVISIONs)
or paragraphs (in the IDENTIFICATION DIVISION) called the division body.
A division is terminated by the next division header in the program, or
by the end of the program in the PROCEDURE DIVISION. The IDENTIFICATION
DIVISION requires a body that specifies the name of the program.

Division Header Format 

The division header consists of the division name, followed by the word
DIVISION, followed by a period and a space.  In the PROCEDURE DIVISION
only, the optional USING phrase may also appear in the header between the
word DIVISION and the period.  In any COBOL program, only the following
division headers are allowed:

     IDENTIFICATION DIVISION. 

     ENVIRONMENT DIVISION. 

     DATA DIVISION. 

     PROCEDURE DIVISION [ USING {data-name-1...}].


NOTE Remember that the terminating periods shown in construct format descriptions must be included. Otherwise, the compiler generally misinterprets the construct.
The IDENTIFICATION, ENVIRONMENT, DATA, and PROCEDURE DIVISIONs, including appropriate headers, appear in Figure 2-2 as items 1 through 4, respectively.


MPE/iX 5.0 Documentation