bdfs1m1e | Structured Programming Macros |
Use this macro group to process specific code repeatedly based on a condition.
The DO macro group includes the following macros:
Format
|
|
If you do not specify an initial value, the TPF system assumes that the loop counter (loopcnt) is already initialized.
If byval is preceded by a minus sign (-), the value is used to decrement the loop counter. For example,
BY,-,1
If you specify a loop counter and do not specify a WHILE or UNTIL parameter, you must specify the TO limit.
C'12345',OFFSET,3
resolves to a substring of C'45'.
See the restrictions listed in the programming considerations.
C'12345',LENGTH,4
resolves to a substring of C'1234'.
See the restrictions listed in the programming considerations.
See the restrictions listed in the programming considerations.
Entry Requirements
None.
Return Conditions
Programming Considerations
Symbols in the conditional expression are evaluated at the beginning of each repetition and can be changed in the DO group to end the loop.
Where y is an odd-numbered register and x is the same as y or is the next lower register.
Case 1 will use a BCT instruction to control the loop, and case 2 will use a BXLE instruction if the control variable is a register.
LET ANS1,=,0 DO NUM1,=,1,TO,10 LET ANS1,=,ANS1,+,1 ENDDO
LET ANS1,=,0 DO NUM1,WHILE,ANS1,LT,10 LET ANS1,=,ANS1,+,1 ENDDO
LET ANS1,=,0 DO NUM1,UNTIL,ANS1,GE,10 LET ANS1,=,ANS1,+,1 ENDDO
Related Macros