COBOL Manual for TNS and TNS/R Programs
Procedure Division Verbs
HP COBOL Manual for TNS and TNS/R Programs—522555-006
9-175
PERFORM VARYING
When two or more AFTER phrases appear, the mechanism is the same as for one
AFTER phrase except:
°
In the second AFTER phrase, vary-2 is also initialized with the value of
base-2 in its associated FROM phrase at the beginning of execution of the
PERFORM statement.
°
In the inner loop (as described earlier), the step “a cycle is performed” is
replaced by “execution proceeds to the second inner loop.”
°
The logic of the second inner loop parallels that of the first inner loop except
for:
°
Its condition plays the role of condition-2.
°
The second vary-2 is increased by the current value of its step-2 after
each cycle is performed.
°
The second vary-2 is initialized with the current value of the base-2 in
its associated FROM phrase when the value of its condition is TRUE.
After termination of a PERFORM statement with two AFTER phrases, vary-1
has the value assigned, either by initialization or increase, at the point where the
evaluation of condition-1 gave a result of TRUE, and each vary-2 has the
value assigned by its last initialization from its associated base-2.
•
Restrictions for Index-Names
When the vary-1 or vary-2 is an index-name, these restrictions apply:
°
The base-1 or base-2 operand must be a positive integer numeric literal,
an index-name, or an identifier that designates an integer numeric data item.
°
The step-1 or step-2 operand must be an integer numeric literal or an
identifier that designates an integer numeric data item.
When the base-1 or base-2 operand is an index-name, these restrictions apply:
°
The associated vary-1 or vary-2 operand must be an index-name or an
identifier that designates an integer numeric data item. It cannot designate a
special register.
°
The associated step-1 or step-2 operand must be an integer numeric
literal or an identifier that designates an integer numeric data item.