Complex Iterative DO Statement

Description

An iterative DO statement can include multiple instances of the iteration-spec. The DO list statement described above is a simple example of this. When multiple instances of the iteration-spec are specified, the DO-group is first executed as many times as required to satisfy the conditions for the first iteration-spec, then as many times as required for the second iteration-spec, and so on, until all instances of the iteration-spec have been used.

Example

DO J = 1 TO 9 WHILE(B(J) ^-= 'xx'), J = 16 TO 20 BY 2;
      READ FILE(F) INTO(REC); 
      B(J) = SUBSTR(REC,6,2); 
      END;

If none of the first eight records read by this loop produce B (J) = 'xx', entries B (1) through B (9) , plus B (16) , B (18) , and B (20) , are set by the loop. If, for example, the third record read produces B (J) = 'xx', only entries B (1) through B (3) , plus B (16) , B (18) , and B (20) are set.