Paragraphs [ HP COBOL II/XL Reference Manual ] MPE/iX 5.0 Documentation
HP COBOL II/XL Reference Manual
Paragraphs
The IDENTIFICATION DIVISION contains the following paragraphs:
PROGRAM-ID, AUTHOR, INSTALLATION, DATE-WRITTEN, DATE-COMPILED, and
SECURITY. A description of these paragraphs follow. All paragraphs in
the IDENTIFICATION DIVISION except the PROGRAM-ID paragraph are obsolete
features of the 1985 ANSI COBOL standard.
PROGRAM-ID Paragraph
This paragraph must appear in every program and must include the
program's name. This name identifies your source program and appears on
the listings associated with it. It must be a unique name with respect
to all program units (HP COBOL II main program or subroutines) compiled
in a particular instance. The name must begin with a letter and cannot
contain more than 30 characters, including hyphens.
The INITIAL clause specifies that when the program is called, that
program and any other programs it contains are in their initial state.
The initial state of a program is the state of the program the first
time it is called as a run unit. Using the INITIAL clause sets
$CONTROL DYNAMIC and is only useful for subprograms.
For a description of the COMMON clause, see Chapter 11 ,
"Interprogram Communication."
The program names of a run unit do not need to be unique. When two
program names in a run unit are the same, at least one of the two
programs must be directly or indirectly contained within another
separately compiled program that does not contain the other of the two
programs.
Example.
The following example shows parts of several programs. Only the
IDENTIFICATION DIVISION, PROGRAM-ID, and END PROGRAM are shown for each
program. For clarity, the lines are appropriately indented. However, in
practice, IDENTIFICATION DIVISION, PROGRAM-ID, and END PROGRAM must start
in margin A.
Program Structure Scope
IDENTIFICATION DIVISION.
PROGRAM-ID. A. Callable by separately compiled program (G below).
:
IDENTIFICATION DIVISION.
PROGRAM-ID. B. Callable by A.
:
END PROGRAM B.
IDENTIFICATION DIVISION.
PROGRAM-ID. C COMMON. Callable by B, A, D and E.
:
END PROGRAM C.
IDENTIFICATION DIVISION.
PROGRAM-ID. D. Callable by A.
:
IDENTIFICATION DIVISION.
PROGRAM-ID. E. Callable by D.
:
END PROGRAM E.
END PROGRAM D.
END PROGRAM A.
IDENTIFICATION DIVISION.
PROGRAM-ID. F. Callable by separately compiled programs (A above or G below).
:
IDENTIFICATION DIVISION.
PROGRAM-ID. A. Callable by F. Note that a call to A from F will call the nested program A, not the
separately compiled program A (above).
:
END PROGRAM A.
IDENTIFICATION DIVISION.
PROGRAM-ID. B. Callable by F.
:
END PROGRAM B.
END PROGRAM F.
IDENTIFICATION DIVISION.
PROGRAM-ID. G.
:
END PROGRAM G.
DATE-COMPILED Paragraph
The DATE-COMPILED paragraph is an obsolete feature of the 1985 ANSI COBOL
standard.
When you enter the DATE-COMPILED paragraph in your source program, the
compiler prints the current date and time on the first line of this
paragraph as it appears on the source program listing. Generally, you
include only the paragraph header (and do not specify a body) when you
enter the source program. On the source listing, the date and time
appear in the following format:
No additional data, either on the same line as the paragraph header or on
subsequent lines, is printed on the source listing.
Other Paragraphs
The remaining paragraphs of the IDENTIFICATION DIVISION, AUTHOR,
INSTALLATION, DATE-WRITTEN, and SECURITY, are obsolete features of the
1985 ANSI COBOL standard.
In the other paragraphs of the IDENTIFICATION DIVISION, which are
optional, the paragraph bodies are treated as comments. Thus, you may
enter any information you wish in any of them. For example, you may use
the AUTHOR paragraph for data other than someone's name.
To continue any of these comment entries onto two or more lines, simply
enter the desired information in Area B of the necessary lines. However,
in this case, do not enter the hyphen continuation indicator in column 7.
The following illustrates a complete IDENTIFICATION DIVISION, showing all
required and optional paragraphs:
IDENTIFICATION DIVISION.
PROGRAM-ID. EXAMPLE-ID-SECTION.
AUTHOR. MANUAL-J-WRITER.
INSTALLATION. GSD-CUST-TRAINING-AND-DOC-GROUP.
DATE-WRITTEN. 07/11/86.
DATE-COMPILED.
SECURITY. NONE.
MPE/iX 5.0 Documentation