COBOL Manual for TNS and TNS/R Programs

Procedure Division Verbs
HP COBOL Manual for TNS and TNS/R Programs522555-006
9-163
PERFORM TIMES
THROUGH
THRU
indicate that a group of procedures is to be executed.
proc-2
is the last procedure in the group.
count
is an integer numeric literal or the identifier of an integer data item that tells the
process how many times to execute the statements in the range of the PERFORM
statement.
imperative-statement
is defined in Imperative Statement.
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-52 specifies that the value of the identifier TRAN-COUNT controls the
number of PERFORM cycles:
In Example 9-53, an in-line PERFORM uses a TIMES phrase to initialize a table of
squares.
Example 9-52. PERFORM TIMES Statement
PERFORM LIST-TRANSACTIONS TRAN-COUNT TIMES.
Example 9-53. 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