Example
PERFORM procedure-name-1 THROUGH procedure-name-2
VARYING identifier-2 FROM identifier-3
BY identifier-4 UNTIL condition-1
- Identifier-2 is set equal to its starting value, identifier-3 (or literal-1).
- Condition-1 is evaluated as follows:
- If it is false, steps 3 through 5 are executed.
- If it is true, control passes directly to the statement following the PERFORM statement.
- Procedure-1 and everything up to and including procedure-2 (if specified) is executed once.
- Identifier-2 is augmented by identifier-4 (or literal-2), and condition-1 is evaluated again.
- Steps 2 through 4 are repeated until condition-1 is true.
At the end of PERFORM statement execution identifier-2 has a value that exceeds the last-used setting by the increment/decrement value (unless condition-1 was true at the beginning of PERFORM statement execution, in which case, identifier-2 contains the current value of identifier-3).
Figure 1 illustrates the logic of the PERFORM statement when an identifier is varied with TEST BEFORE. Figure 2 illustrates the logic of the PERFORM statement when an identifier is varied with TEST AFTER.
Figure 1. Varying One Identifier—with TEST BEFORE

Figure 2. Varying One Identifier—with TEST AFTER
