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

Example 123 PERFORM UNTIL Statement
WORKING-STORAGE SECTION.
01 ANY-ADDS-CV PICTURE 9.
88 SOME-MORE-ADDS VALUE 0.
88 NO-MORE-ADDS VALUE 1.
...
PROCEDURE DIVISION.
...
MOVE 0 TO ANY-ADDS-CV
PERFORM ADD-ROUTINE UNTIL NO-MORE-ADDS
...
ADD-ROUTINE.
...
PERFORM VARYING
PERFORM VARYING executes a loop of procedures. PERFORM VARYING with TEST BEFORE is a
while loop;” with TEST AFTER, it is a “repeat loop.
A single PERFORM VARYING statement containing one or more AFTER phrases enables you to
perform nested loops of procedures. The last AFTER phrase defines the innermost loop. The first
set of parameters in the VARYING phrase defines the outermost loop.
procedure-group
proc-1
is a paragraph-name or section-name. Without THROUGH or THRU, proc-1 is the only
procedure that is to be executed. With THROUGH or THRU, proc-1 is the first procedure
of a group.
THROUGH, THRU
indicate that a group of procedures is to be executed.
396 Procedure Division Verbs