Figure description: PERFORM VARYING with TEST AFTER
This figure shows the processing steps for a PERFORM statement with the TEST AFTER phrase and two identifiers in the VARYING phrase. The following example shows such a PERFORM statement:
PERFORM c1 THRU C2 TEST AFTER VARYING
identifier-2 FROM 1 BY 1 UNTIL condition-1
AFTER
identifier-5 FROM 1 BY 1 UNTIL condition-2
See the following processing steps:
- Set identifier-2 to 1 (its FROM value).
- Set identifier-5 to 1 (its FROM value).
- Perform procedures c1 through c2.
- Test condition-2.
- If condition-2 is false:
- Add 1 (the BY value) to identifier-5.
- Loop to perform procedures c1 through c2.
- If condition-2 is true:
- Test condition-1.
- If condition-1 is false:
- Add 1 (the BY value) to identifier-2.
- Loop to set identifier-5 to 1 (its FROM value) and perform procedures c1 through c2.
- If condition-1 is true, exit the PERFORM statement
End of figure description.