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

Procedure Division Verbs
HP COBOL Manual for TNS/E Programs520347-003
9-151
PERFORM TIMES
END-PERFORM
ends the scope of the PERFORM statement, causing the PERFORM to be a
delimited-scope statement. If the PERFORM statement does not end with an END-
PERFORM phrase, it is an out-of-line PERFORM. If the PERFORM statement
ends with an END-PERFORM phrase, it is an in-line PERFORM.
Example 9-50 specifies that the value of the identifier TRAN-COUNT controls the
number of PERFORM cycles:
In Example 9-51, an in-line PERFORM uses a TIMES phrase to initialize a table of
squares.
Usage Considerations:
Negative or Zero Value in the TIMES Phrase
The value of count can be a negative integer or 0, in which case the process
does not perform the procedure or group.
See the usage considerations in Unconditional PERFORM.
Example 9-50. PERFORM TIMES Statement
PERFORM LIST-TRANSACTIONS TRAN-COUNT TIMES.
Example 9-51. PERFORM TIMES Statement
MOVE 1 TO R
PERFORM 100 TIMES
MULTIPLY R BY R GIVING R-SQ (R)
ON SIZE ERROR MOVE "OVERFLOW" TO REASON
PERFORM REPORT-DEMISE
END-MULTIPLY
ADD 1 TO R
END-PERFORM