EXIT statement
Remarks#
The COBOL EXIT statement is a terminating flow control verb.
EXIT comes is a few flavours:
- bare
EXITis a common end point for a series of procedures. EXIT PARAGRAPH,EXIT SECTIONprovides a means of exiting a structured procedure without executing any of the subsequent statements.EXIT FUNCTION,EXIT METHOD,EXIT PROGRAMmarks the logical end of a module of code.EXIT PERFORMbreaks out of a inline perform loop.EXIT PERFORM CYCLEcauses an inline perform loop to begin the next iteration.
EXIT statement
PERFORM VARYING counter FROM 1 BY 1 UNTIL counter > 10
IF debug-override THEN EXIT PERFORM
IF counter = 5 THEN EXIT PERFORM CYCLE
PERFORM some-miracle
END-PERFORM