Ü  LEAVE (Leave the innermost loop)

§  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.

§  The LEAVE (Leave a Do/For Group) operation is similar to the ITER operation. The ITER operation takes the control to ENDDO, ENDFOR while LEAVE transfers control to the statement following the ENDDO or ENDFOR operation.

Example


0070.00 C     ENTSR         BEGSR
0072.00 C                   EXSR      CLRWND
0073.00 C                   EXSR      FILLWND
0075.00 C                   EXSR      DSPWND
0076.00 C                   EXSR      VALIDATE
0080.00 C                   DOW       @ERROR='Y'
0081.00 C   12              LEAVE              >>>> IF F12 or F3 is pressed, the control is
0082.00 C   03              LEAVE                      taken out of the DOW loop.
0085.00 C                   SETON                                        2526
0087.00 C                   WRITE     ACC_FOOTER
0090.00 C                   EXFMT     ACC_CTL
0091.00 C                   SETOFF                                       9394
0092.00 C                   EXSR      VALIDATE
0093.00 C                   ENDDO
0094.00 C                   SETOFF                                       9394
0095.00 C                   IF        @ERROR='N'
0096.00 C                   EXSR      UPDATEPF
0097.00 C                   ENDIF
0098.00 C                   ENDSR

 





User Comments:





Copyright © Go4as400.com, 2013-2017. Copyright notice