COBOL Manual for TNS/E Programs (H06.08+, J06.03+)

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.
Example 118 Unconditional PERFORM Statement With One Paragraph
IF REPORT-A
PERFORM DO-REPORT-A
END-IF
Example 119 Unconditional PERFORM Statement With Several Paragraphs
IF REPORTS-TO-DO
PERFORM DO-REPORTS THRU DO-REPORTS-EXIT.
IF MUST-EXIT
...
DO-REPORTS.
...
(several paragraphs to create the reports)
...
DO-REPORTS-EXIT.
EXIT.
An in-line PERFORM statement can contain delimited-scope statements (such as a delimited-scope
READ or IF statements) because they count as imperative statements.
392 Procedure Division Verbs