COBOL Manual for TNS and TNS/R Programs

Procedure Division
HP COBOL Manual for TNS and TNS/R Programs522555-006
8-16
Execution of the Procedure Division
section
is described in Sections.
Execution of the Procedure Division
Execution of a run unit begins with the first procedure (that is, section or paragraph) of
the Procedure Division, excluding any declarative sections. Except where specific rules
indicate otherwise, sections are executed in the order in which they appear within the
source program. Similarly, paragraphs are executed in the order in which they appear
within their sections, sentences are executed in the order in which they appear within
their paragraphs, and statements are executed in the order in which they appear within
their sentences.
Topics:
Statement Execution
Sentence Execution
Paragraph Execution
Section Execution
Procedure Execution
Declaratives Portion Execution
Statement Execution
An individual imperative statement is always executed in its entirety. If the statement is
followed within its sentence by another statement, control then passes to that
statement; otherwise, control passes to the next executable sentence.
A conditional statement or a delimited-scope statement is not necessarily executed in
its entirety. Instead, the truth value of the condition in the statement causes the object
program to select between alternate paths of control. Because the specific possibilities
depend upon the particular statement, they are discussed along with the individual
statement descriptions.
Example 8-8. Procedure Division with a Declaratives Portion
PROCEDURE DIVISION.
DECLARATIVES.
IN-FILES-USE SECTION.
USE AFTER STANDARD ERROR PROCEDURE ON IN-FILE.
IN-FILES-PARA.
...
END DECLARATIVES.
BEGIN-MY-PROGRAM SECTION.
...