DO statement

The DO statement causes repetitive generation of DFLD and RCD statements between the DO and ENDDO statements.

When DO is used, there are restrictions in the naming of DFLDs.

Format

Read syntax diagramSkip visual syntax diagram
                         .-,1------------------.   
>>-+-------+--DO--count--+---------------------+---------------->
   '-label-'             +-,line-increment-----+   
                         '-,position-increment-'   

   .-,MAX--------------.                         
>--+-------------------+--+------------------+------------------>
   '-,column-increment-'  |       .-01-----. |   
                          '-,SUF=-+-number-+-'   

>--+-------------------+---------------------------------------><
   |         .-LINE--. |   
   '-,BOUND=-+-FIELD-+-'   

Parameters

label
A one- to eight-character alphanumeric name can be specified. It is not used.
count
Specifies how many times to generate the statements.
line-increment
Specifies how much to increase the line position after the first cycle. The first cycle uses the lll value specified in the POS= keyword of the DFLD statement. The default is 1. This parameter is not specified for DEV type DPM-An or DPM-Bn.
position-increment
Specifies how much to increase the position parameter after the first cycle. The first cycle uses the nnn value specified in the POS= operand of the DFLD statement. The position increment is used for an input device format when MODE=STREAM is specified. This parameter is not specified for DEV type DPM-An or DPM-Bn.
MAX
Specifies that the line increment to be used at the end of each cycle and the column values in the DFLDs are to remain the same for each cycle. This parameter is not used if MODE=STREAM is specified for the device format or if DEV type is DPM-An or DPM-Bn; if present, it is ignored.
column-increment
Specifies how much to increase the column position after the first cycle. The first cycle uses the ccc value specified in the POS= keyword of the DFLD statement. The default is MAX. This parameter is not used for DEV type DPM-An or DPM-Bn, or when MODE=STREAM is specified for the device format, because it is ignored.
SUF=
Specifies the 2-digit suffix to be appended to the dfldname of the first group of generated DFLD statements. The default is 01. MFS increments the suffix by one on each subsequent generation of statements.

If the specified suffix exceeds 2 digits, MFS uses the rightmost 2 digits.

If the specified count is such that the generated suffix eventually exceeds 2 digits, MFS reduces the count to the largest legitimate maximum value. For example, if count equals 8 and SUF=95, invalid suffixes of 100, 101, and 102 would result. In this instance, MFS reduces the count to 5, processes the statement, and issues an error message.

BOUND=
Specifies when updates to line position and column position are to occur. The default is LINE. This parameter is not used if MODE=STREAM is specified for the device format or if DEV type is DPM-An or DPM-Bn; if present, it is ignored.
LINE
Specifies that all fields be inspected before the repetition is performed. If the column increment would cause any field in the group of DFLD statements to not fit on a line, the column position value for all fields is reset to the initial value, and the line position values are increased by the line-increment value.
FIELD
Specifies that each time the statement is repeated, the column position value is increased by the column-increment value. If MAX is specified, or the new column position value reaches device line length capacity, the line position value is increased by the line-increment value and the column position value is reset to its initial value.

Example of line and column increment

The following example demonstrates how to increment lines and columns:

     DO      20,1,38
A1	  DFLD    POS=(9,6),LTH=6
B1   DFLD    POS=(9,27),LTH=3

In this example, A1 and B1 are increasing by line increment (1) and column increment (38). Generation would proceed in the following fashion by a compiler:

  • Add the column increment to each column value in the set, resulting in positions (9,44) and (9,65).
  • Test to see if any field using these new column values would exceed the line size limitation for this device. In this example, assume a limitation of 80 for a 3270 Model 2.
  • Since there is no violation of line width, generate A2 and B2 using the new column values and the same line value.
  • Add the column increment again, resulting in positions (9,82) and (9,103).
  • Since the fields would exceed line width, the column values are reset to the original values of (9,6) and (9,27) and the line increment is applied. The resulting positions are now (10,6) and (10,27).
  • Generate A3 and B3 using the new line values, with column values as in the original statements.

Generation continues in this manner until the count of 20 iterations is reached.

Printing generated DFLD statements

The generated DFLD statements can be printed in a symbolic source format by specifying COMP in the parameter list of the EXEC statement. This provides a means of seeing the results of the DFLD statement generation without having to interpret the intermediate text blocks.

The following items are printed for each generated DFLD statement:

  • The generated statement sequence number followed by a plus sign (+) to indicate that the DFLD statement was generated as a result of DO statement processing.
  • The DFLD statement label, if present, including the appended suffix.
  • The statement operator, DFLD.
  • For EGCS literals, the G, SO, and SI are not present. Literals are truncated if there is insufficient room to print all specifications. Truncation is indicated by a portion of the literal with three periods (...), representing the truncated portion.
  • ATTR=(YES,nn), if present.
  • ATTR=YES, if present.
  • ATTR=nn, if present.
  • ATTR=(...), if attributes are present.
  • EATTR=(...), if present.
  • The RECORD or STREAM form of the POS= keyword, with the line and column or stream position updated by the respective increments. This is not printed if DEV type is DPM-An or DPM-Bn.
  • SCA, if present.
  • The field length, in the form of LTH=nnnn.

No other operands are printed, even if specified on the source DFLD statement.

For device type DPM-An or DPM-Bn, the RCD statement can appear between a DO and ENDDO statement. If it does, a new record boundary is created for each repetitive generation of the DFLD field following the RCD statement. For example, the following sequence causes the DFLDs A01, B01, and C01 to be in record 1, while A02, B02, and C02 are in record 2, and A03, B03, and C03 are in record 3.

    DO 3
    RCD
A   DFLD    LTH=10
B   DFLD    LTH=10
C   DFLD    LTH=10
    ENDDO

Alternatively, the RCD statement can immediately precede the DO statement. If it does, a new record boundary begins with the first DFLD after the DO statement and does not end until the ENDDO statement (or the maximum record length) is reached. For example, the following sequence causes the DFLD D01 to begin a new record, in which E01, D02, and E02 also occur.

    RCD
    DO 2
D   DFLD    LTH=10
E   DFLD    LTH=10
    ENDDO