Figure description: PERFORM VARYING with TEST BEFORE

This figure shows the processing steps for a PERFORM statement with the TEST BEFORE phrase and one identifier in the VARYING phrase. The following example shows such a PERFORM statement:


PERFORM c1 THRU c2 TEST BEFORE VARYING identifier-2 FROM 1 BY 1 UNTIL condition-1

See the following processing steps:

  1. Set the varying field identifier-2 equal to the FROM value 1.
  2. Test condition-1.
  3. If condition-1 is false:
    1. Perform procedures c1 through c2.
    2. Add the BY value 1 to identifier-2.
    3. Loop to step 2 to test condition-1 again.
  4. If condition-1 is true, exit the PERFORM statement.

End of figure description.