There are two forms for the DO construct. The simple DO construct described here
and the iterated DO construct described in the next topic.
A simple DO construct takes the form:
This causes the block of statements to be repeated. Typically, within the block
of statements, there will be an IF statement of the form:
The EXIT statement causes control to pass to the statement following END DO.
The CYCLE statement is an alternative to EXIT. It causes control to pass to a
point immediately after the last statement of the block, allowing repetition to
DO constructs can be named. If a DO construct
is named then the same name must be appended to the corresponding END DO and
may optionally be appended to an enclosing EXIT or CYCLE. If DO
constructs are nested, one within another, then a name attached to EXIT or
CYCLE provides an extra degree of control.
A DO WHILE construct provides an alternative construction in the form:
This is equivalent to: