Pathway/iTS SCREEN COBOL Reference Manual (H06.10+, J06.03+)
Procedure Division
HP NonStop Pathway/iTS SCREEN COBOL Reference Manual—426750-003
6-81
PERFORM Statements
PERFORM TIMES Statement
The PERFORM TIMES statement executes a procedure, or group of procedures as
established by the THROUGH phrase, a specified number of times. When the
specified number of executions complete, control passes to the statement following the
PERFORM TIMES statement.
proc-1
and
proc-2
are the procedure paragraphs or sections to be executed.
count
is an integer literal or the identifier of an integer data item. The procedure, or
group of procedures, is executed as many times as the value of
count
.
The following example illustrates the PERFORM TIMES statement:
PERFORM list-transactions 2 TIMES.
PERFORM UNTIL Statement
The PERFORM UNTIL statement executes a procedure, or group of procedures as
established by the THROUGH phrase, based on a condition. The condition is checked
before each PERFORM cycle. When the condition is met, control passes to the
statement following the PERFORM UNTIL statement.
proc-1
and
proc-2
are the procedure paragraphs or sections to be executed.
condition
is any conditional expression.
The following example illustrates the PERFORM UNTIL statement:
WORKING-STORAGE SECTION.
01 flag PIC 9.
88 bad VALUE 0.
88 good VALUE 1.
88 no-more-adds VALUE 1.
:
PROCEDURE DIVISION.
:
PERFORM add-routine UNTIL no-more-adds.
PERFORM
proc-1
[ { THROUGH }
proc-2
]
count
TIMES
[ { THRU } ]
PERFORM
proc-1
[ { THROUGH }
proc-2
] UNTIL
condition
[ { THRU } ]










