Begins a sequence of preprocessor statements to be executed in a group.
%[labe1:]... DO[index = start[TO finish[BY increment]] | [BY increment [TO finish]]];
Where index is a preprocessor variable; start, finish, and increment are preprocessor expressions.
%DECLARE IX FIXED; %DO IX = 1 TO 4; A(IX) = IX; %END
The text generated by this example would be as follows:
A(1) = 1; A(2) = 2; A(3) = 3; A(4) = 4;
Description
The %DO statement and its corresponding %END statement delimit a preprocessor DO group and can also specify repetitive execution of the DO group.
Preprocessor DO groups can be nested. Both preprocessor statements and text other than preprocessor statements can appear within a preprocessor DO group. However, only the preprocessor statements are executed. Nonpreprocessor statements are scanned but only for possible replacement activity. Non-iterative preprocessor DO groups are useful as THEN or ELSE clauses of %IF statements.
If increment is ≤ 0 or start > finish, the body of the loop is not executed.