NAME

resume - resume execution after error recovery

SYNOPSIS

resume [LineNum]
resume [LineLab]
resume next

DESCRIPTION

Resume causes resumption of execution following error recovery.  If a line number or label is specified, as in the first two forms, execution resumes with the statement at the beginning of the line specified.  If no line number or label is specified or if line number 0 is specified, execution resumes with the statement at the beginning of the line where the error occurred. 

The second form, resume next causes execution to resume with the statement at the beginning of the line immediately following the one where the error occurred. 

An error recovery routine must lie outside any subprogram even if the routine is to trap errors within a subprogram.  The resume statement may not be used within a subprogram.  In general, a line number or label reference outside any subprogram must refer to a line also outside any subprogram.  Resuming to a particular line number or label is an exception: no such restriction exists.  The error recovery routine is responsible for seeing that execution resumes within the subprogram (if any) which caused the error lest the control structure of the program be corrupted.  This problem can not occur with resume 0 or resume next

A module’s error handling routines are private to the module.  The possibility (and opportunity) exists to have an error handling routine in each of several modules concurrently identified and prepared to execute in case of error.  Transfer of control between modules due to error handling is impossible. 

EXAMPLE

In the following code fragment, the error trapping routine begins at line 100.  The resume statement causes control to return to line 30 when error 13 or 50 occurs in line 50. 
	10  on error goto 100
		.
		.
	100 if (err = 13) and (erl = 50) then_
		 print "TRY AGAIN" : resume 30

SEE ALSO

error, on error
basic(1) in the Supplemental Documentation section

DIAGNOSTICS

A "RESUME without error" error will occur when a resume is executed and no error has occurred yet or since the last resume was executed. 

A "NO RESUME" error will occur when after having trapped an error, the program attempts to terminate normally without having executed a resume statement. 

USAGE NOTES

There is a certain overhead associated with providing error handling at run-time, primarily in the form of additional code in the executable module.  If error-handling is not desired at run-time, this overhead can be eliminated by using the -L option when compiling.  See basic(1) in the Supplemental Documentation section of this manual for details. 

from The Basmark QuickBASIC Programmer’s Manual by Lawrence Leinweber