bdfs1m1eStructured Programming Macros

DO Macro Group

Use this macro group to process specific code repeatedly based on a condition.

The DO macro group includes the following macros:

Format







DO
specifies the start of the DO structure. If you do not specify any parameters, an unconditional loop is generated; use the LEAVE or GOTO macro to avoid creating an infinite loop. See LEAVE-Exit from a DO Loop and GOTO-Branch Macro for more information about the LEAVE and GOTO macros.

loopcnt
is an arithmetic variable used to control the loop. An arithmetic variable is a symbol that represents a numeric value.

init
is an initial value for the loop counter (loopcnt). The initial value can be one of the following:

If you do not specify an initial value, the TPF system assumes that the loop counter (loopcnt) is already initialized.

BY,byval
specifies a value that is used to increment or decrement the loop counter, where byval is a number or a symbol that represents a number.

If byval is preceded by a minus sign (-), the value is used to decrement the loop counter. For example,

   BY,-,1

TO,limit
specifies when to end the loop, where limit is a number or a symbol that represents a number. The limit is compared to the loop counter, and when the value of loopcnt is greater than the value of limit the loop exits. If byval is preceded by a minus sign (-), the loop exits when loopcnt is less than limit.

If you specify a loop counter and do not specify a WHILE or UNTIL parameter, you must specify the TO limit.

WHILE
specifies the start of a DO WHILE loop based on a conditional expression. The loop is processed only if and while the conditional expression is true.

UNTIL
specifies the start of a DO UNTIL loop based on a conditional expression. The loop is processed only if and while the conditional expression is false.

ccmask
is any value that can be used as the mask in a branch on condition instruction. The SPMEQ equate macro defines some of these condition code masks.

booleanop
is one of the following Boolean connectors:

arithval
is a number represented directly in numeric form or in symbolic form. This value can be one of the following:

operator
is one of the following relational operators:
Operator
Description
 = 
Equal
 EQ 
Equal
 ¬= 
Not equal
 NE 
Not equal
 < 
Less than
 LT 
Less than
 > 
Greater than
 GT 
Greater than
 <= 
Less than or equal
 LE 
Less than or equal
 >= 
Greater than or equal
 GE 
Greater than or equal.

strcon
is a string constant, which can be one of the following:

strsymbl
is a symbol that represents a character string. This symbol must be defined with a CHARACTER attribute. See DCL-Declare for more information about defining the attribute for a symbol.

OFFSET,byteoff
specifies a substring, where byteoff is the distance (starting from zero) from the leftmost byte of the string. For example,
  C'12345',OFFSET,3

resolves to a substring of C'45'.

See the restrictions listed in the programming considerations.

LENGTH,bytelen
specifies a substring, where bytelen is the length of the string starting from the leftmost byte. For example,
  C'12345',LENGTH,4

resolves to a substring of C'1234'.

See the restrictions listed in the programming considerations.

PAD,padval
concatenates a character, padval, on the end of a string to fill out the string to the end of the declared length.

See the restrictions listed in the programming considerations.

bitsymbl
is a symbol that represents a value for the bit mask comparison. This symbol can be defined with any attribute, but only the leftmost byte is used in the comparison. See DCL-Declare for more information about defining the attribute for a symbol.

L'bitsymbl
specifies the length of bitsymbl and resolves to the number of bytes of storage that bitsymbl represents.

MASK,bitmsk
specifies a bit mask, where bitmsk is a value that can be used as immediate data for a test under mask (TM) instruction. See ESA/370 Principles of Operation or ESA/390 Principles of Operation for more information about the TM instruction.

code1
is the code to process.

ENDDO
ends the loop processing.

Entry Requirements

None.

Return Conditions

Programming Considerations

Examples

Related Macros