EXIT Statement Example


Scenario - EXIT usage in paragraph.

Code -

----+----1----+----2----+----3----+----4----+----5----+
       IDENTIFICATION DIVISION.
       PROGRAM-ID. EXITPARA.
       AUTHOR. MTH.

       PROCEDURE DIVISION.
           PERFORM 1000-DISPLAY 
              THRU 1000-EXIT.
           STOP RUN.

       1000-DISPLAY.
           DISPLAY "PARAGRAPH EXIT EXAMPLE".
       1000-EXIT.
           EXIT.

Explaining Example -

In the above example:

  • 1000-EXIT is the paragraph coded only with EXIT statement that acts as a exit paragraph for 1000-DISPLAY.