COBOL Manual for TNS/E Programs (H06.03+)
Procedure Division Verbs
HP COBOL Manual for TNS/E Programs—520347-003
9-148
Unconditional PERFORM
°
The sequence of statements executed in any cycle of one PERFORM
statement must not allow control to reach the return point for any other active
PERFORM statement in which it is nested. If this does happen, neither
PERFORM cycle terminates, and control falls through to succeeding
statements.
°
The sequence of statements executed in any cycle of one PERFORM
statement must not allow control to reach any active PERFORM statement,
including itself.
°
As a consequence of the preceding rules, a cycle of an active PERFORM
statement cannot end until after any PERFORM statements nested within it
complete their execution.
The maximum number of PERFORM statements that can be nested is 50.
Violation of the preceding rules often causes run-time diagnostic 148.
•
Placement of Procedures
As a general rule, both proc-1 and proc-2 must be in the same logically
discrete area of the Procedure Division (in a specific declarative procedure,
including any associated sections, or in the portion of the Procedure Division that
does not include declaratives). Most violations of this rule cause the compiler to
issue a warning but to accept the PERFORM statement; however, if either proc-1
or proc-2 is in the Declaratives Portion, then both must be in the Declaratives
Portion.
•
Placement of PERFORM Statements
As a general rule, a PERFORM statement must be in the same logically discrete
area of the Procedure Division as proc-1 and proc-2. Most violations of this
rule cause the compiler to issue a warning; however, certain combinations are
explicitly permitted, and others are totally prohibited:
°
For any PERFORM statement, proc-1 and proc-2 can be in any
nondebugging declarative procedure; however, the compiler issues a warning if
proc-1 and proc-2 are in two different declarative procedures.
°
When the PERFORM statement is in a debugging declarative procedure, its
proc-1 and proc-2 can be in any declarative procedure; however, the
compiler issues a warning if proc-1 and proc-2 are in two different
declarative procedures.
°
When the PERFORM statement is not in a debugging declarative procedure,
neither proc-1 nor proc-2 can be in any debugging declarative procedure.
°
When the PERFORM statement is in the Declaratives Portion, neither proc-1
nor proc-2 can be in the other portion of the Procedure Division.










