Previous Topic: PROCESS NEXT StatementNext Topic: REFRESH Statement


QUIT Statement

The QUIT statement causes the flow of control to abandon one or more current constructs, procedures, or the current program. Subsequent flow of control continues as if the affected constructs, procedures, or program were exited normally.

This statement has the following format:

     [labelofFORorLOOP                         ]
     [PROGRAM                                      ]
     [RUN                                          ]
QUIT [label‑of‑procedure                           ]
     [PROCEDURE                                    ]
    
QUIT

With no operands, terminates the current FOR or LOOP construct or procedure. The statement following the ENDFOR, ENDLOOP, or ENDPROC executes next. When a QUIT statement applies to a FOR construct, no updates to the current dataview record are applied.

label‑of‑FOR‑or‑LOOP

Terminates the label of the construct. The QUIT label‑of‑FOR‑or‑LOOP statement can only execute in the logical scope of that labeled construct or in an ERROR PROCEDURE construct.

PROGRAM

A reserved word that terminates the current program or subprogram. QUIT PROGRAM is not required at the normal end of a program since the end of the main procedure of a program implies a QUIT PROGRAM. The abbreviation PGM cannot be used in this statement.

RUN

A reserved word that terminates the current program and all other programs currently active in the run‑unit.

label‑of‑procedure

The label of a procedure to terminate. This must be the current procedure or an active procedure that directly or indirectly invoked the current procedure.

PROCEDURE

A reserved word that terminates the current procedure. Control returns to the invoking procedure. If a QUIT is issued for the main procedure, QUIT PROCEDURE is the equivalent of QUIT PROGRAM.

Example

<<UP_DATE>> PROCEDURE
    <<FOR_1>>
         FOR NEW updatable_dvw_name
           MOVE 'X' TO dvw_field
           DO DETERMINE_CONT
           IF condition
              DO EXIT
           ENDIF
           DO REST_UPDATE
        ENDFOR
ENDPROC
<<EXIT>> PROCEDURE
      QUIT UP_DATE
ENDPROC