Varying phrase rules

There are certain rules that apply to this phrase, no matter how many variables are specified.

The rules are:

  • In the VARYING or AFTER phrases, when an index-name is specified:
    • The index-name is initialized and incremented or decremented according to the rules under INDEX phrase. (See also SET statement.)
    • In the associated FROM phrase, an identifier must be described as an integer and have a positive value; a literal must be a positive integer.
    • In the associated BY phrase, an identifier must be described as an integer; a literal must be a nonzero integer.
  • In the FROM phrase, when an index-name is specified:
    • In the associated VARYING or AFTER phrase, an identifier must be described as an integer. It is initialized as described in the SET statement.
    • In the associated BY phrase, an identifier must be described as an integer and have a nonzero value; a literal must be a nonzero integer.
  • In the BY phrase, identifiers and literals must have nonzero values.
  • Changing the values of identifiers or index-names in the VARYING, FROM, and BY phrases during execution changes the number of times the procedures are executed.