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:

  1. Set identifier-2 to 1 (its FROM value).
  2. Set identifier-5 to 1 (its FROM value).
  3. Perform procedures c1 through c2.
  4. Test condition-2.
  5. If condition-2 is false:
    1. Add 1 (the BY value) to identifier-5.
    2. Loop to perform procedures c1 through c2.
  6. If condition-2 is true:
    1. Test condition-1.
    2. 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.
    3. If condition-1 is true, exit the PERFORM statement

End of figure description.