
Chapter 18 Error Controls
18-5
RESUME (Statement)
Function
Returns from an interruption process routine.
Format
RESUME [NEXT|<Label name>]
Explanation
This statement returns to the program before it has been branched from an
interruption process routine, as defined in the ON ERROR GOTO statement.
With RESUME NEXT, the program returns to the line following the line where
an error occurred.
With RESUME <Label name>, the program passes control to a designated
label line.
If you ignore all of the argument options in the RESUME statement, the
program returns to the line where the error occurred.
Remarks (1): This command has no meaning when “Error interruption
process code deletion” is set to ON (1) in [Program] of
[Project setting] of PAC manager in WINCAPSII.
The same setting has been prepared in the teach
pendant.
Remarks (2): If the program returns to the line where the error
occurred, without removal of the error cause, the
program may execute an infinite loop.
Remarks (3): You cannot use this statement outside of the interruption
process routine.
Related Terms
ON ERROR GOTO
Example
DIM Li1 As INTEGER
DIM Li2% (2, 3)
ON ERROR GOTO *Error1 'When an error occurs, the program branches to the
'process routine of Error1.
FORLil=0TO3
Li2 (0, Li1) = 0 'When Li1 is 3, an error occurs and the program branches
'to the process routine *Error1.
NEXT Li1
*R_Label:
END
*Errorl: 'Declares the *Errorl label
S1= “Line” +STR$(ERL)+ “:” b+ERRMSG$(ERR)
'Edits the error message.
PRINTMSG S1,2, “error” 'Outputs error information.
IF ERR = &H3B3E THEN
RESUME NEXT 'Returns to the line following the line where the
'error occurred.
ELSE
RESUME *R_Label 'Returns the line of *R_Label.
ENDIF
Komentáře k této Příručce