EXIT HANDLER
EXIT HANDLER
cancels the execution of the exception handler and then restores the control to the state of exception.
EXIT HANDLER can be written only in an exception handler.
EXIT HANDLER resembles CAUSE EXCEPTION EXTYPE, but when an EXIT HANDLER statement is executed, the origin becomes the statement that first caused an exception. Therefore, differences shall be made if a RETRY or CONTINUE statement is executed in a superior exception handler.
Example 1. 145-line shall be executed.
100 WHEN EXCEPTION IN 110 WHEN EXCEPTION IN 120 PRINT 1/0 125 PRINT "125" 130 USE 140 CAUSE EXCEPTION EXTYPE 145 PRINT "145" 150 END WHEN 160 USE 170 CONTINUE 180 END WHEN 190 END
Example 2. 125-line shall be executed.
100 WHEN EXCEPTION IN 110 WHEN EXCEPTION IN 120 PRINT 1/0 125 PRINT "125" 130 USE 140 EXIT HANDLER 145 PRINT "145" 150 END WHEN 160 USE 170 CONTINUE 180 END WHEN 190 END