A do-loop may occur at any point in the GROUPS, VARIABLES, CONSTANTS, RANGES, BOUNDS, START POINT, NewQUADRATIC, ELEMENT USES or GROUP USES sections. Do-loops are used to make array definitions, that is, to make compact definitions of several quantities at once. The syntax required for do-loops is given in Figure 3.6.
The two-character string in data field 1 specifies either the start or the end of a do-loop. The start of a loop is indicated by the string DO. In this case an integer parameter named in field 2 is defined to take values starting from the integer parameter value given in field 3 and ending with the last value before the integer parameter value given in field 5 has been surpassed. The parameters named in fields 3 and 5 must have been defined on previous data cards. The parameter name defined in field 2 can occupy up to ten locations. If the next data card does not have the characters DI as its first field, the parameter defined on the DO card, iloop say, will take all integer values starting from that given in field 3, say istart, and ending on that in field 5, iend say. If istart is larger than iend, the loop will be skipped.
If the data card
following a DO
card has the string DI
in field 1, the do-loop parameter
named in field 2 is to be
by the amount, incr say, specified for the integer
parameter given in field 3. Once again, the parameter in field 3 must
have been previously defined. The index iloop will now take
Once a do-loop has been started, any array definitions which use its do-loop index specify that the definition is to be made for all values of the integer parameter specified in the loop. Loops can be nested up to three deep; this corresponds to the maximum number of allowed indices in an array index list.
A do-loop must be terminated. A particular loop can be terminated on a data card in which field 1 contains the characters OD; the name of the loop parameter must appear in field 2. Alternatively, all loops may be terminated at once using a data card in which field 1 contains the characters ND.
In addition, parameter assignments with the syntax given in Figure 3.5 -- that is, cards whose first field are IE, IR, IA, IS, IM, ID, I=, I+, I-, I*, I/, RE, RI, RA, RS, RM, RD, RF, R=, R+, R-, R*, R/, R(, AE, AI, AA, AS, AM, AD, AF, A=, A+, A-, A*, A/ or R( -- may be inserted at any point in a do-loop; it is only necessary that a parameter is defined prior to its use.
Note that array definitions may occur both within and outside do-loops; all that is required for a successful array definition is that the integer indices used have defined values when they are needed. The use of do-loops is illustrated in Section 3.4.