LEAVE (Leave a Do/For Group)
Free-Form Syntax | LEAVE |
Code | Factor 1 | Factor 2 | Result Field | Indicators | ||
---|---|---|---|---|---|---|
LEAVE |
The LEAVE operation transfers control from within a DO or FOR group to the statement following the ENDDO or ENDFOR operation.
You can use LEAVE within a DO, DOU, DOUxx, DOW, DOWxx, or FOR loop to transfer control immediately from the innermost loop to the statement following the innermost loop's ENDDO or ENDFOR operation. Using LEAVE to leave a DO or FOR group does not increment the index.
In nested loops, LEAVE causes control to transfer “outwards” by one level only. LEAVE is not allowed outside a DO or FOR group.
The ITER (Iterate) operation is similar to the LEAVE operation; however, ITER transfers control to the ENDDO or ENDFOR statement.
For more information, see Branching Operations or Structured Programming Operations.