bdfs1m1h | Structured Programming Macros |
Use this macro to exit a DO loop when the condition being tested by the corresponding CASE, IF, or SELECT macro is true.
Format
|
Entry Requirements
You must code this macro between a DO and ENDDO macro group and after a CASE, IF-THEN, or SELECT macro statement.
Return Conditions
When the condition being tested for is true, LEAVE causes processing to continue with the next sequential instruction following the ENDDO statement of the current DO-ENDDO block, or as many levels of DO-ENDDO blocks as specified by the level parameter.
Programming Considerations
None.
This example sets up a DO loop to add 1 to the contents of R1 10 times. When the value of control variable LPCNT exceeds 8, the IF statement is true and the LEAVE macro is processed. This causes processing to continue with R1 equal to 8 beginning after the ENDDO statement.
LA R1,0 DO LPCNT,=,1,TO,10 IF LPCNT,GT,8 THEN LEAVE , ENDIF LA R1,1(,R1) ENDDO
Related Macros