COBOL Manual for TNS and TNS/R Programs

Procedure Division Verbs
HP COBOL Manual for TNS and TNS/R Programs522555-006
9-171
PERFORM VARYING
After each termination of the inner loop, the process evaluates condition-1
again:
°
If the value of condition-1 is FALSE, execution proceeds to the inner loop,
as described in the preceding text.
°
If the value of condition-1 is TRUE, execution of the statement terminates.
After termination of the PERFORM statement, vary-1 has the value assigned,
either by initialization or augmentation, at the point where the evaluation of
condition-1 gave a result of TRUE. vary-2 has the value assigned by its last
initialization from the base-2.
Figure 9-8. Execution of a PERFORM VARYING Statement
With a TEST BEFORE Phrase and One AFTER Phrase
Enter
Set vary-1 to
current base-1
value.
Execute the
range of the
PERFORM.
Augment
vary-2
with step-2 .
condition-2
?
FALSE
Exit
TRUE
Set vary-2 to
current base-2
value.
condition-1
?
FALSE
Augment
vary-1
with step-1 .
TRUE
Set vary-2
to base-2 .
VST511.vsd