Other Statements - Sharp MZ-700 Owner's Manual

Hide thumbs Also See for MZ-700:
Table of Contents

Advertisement

2.10
.
O ther Statements
2.1 0.1
ON ERROR GOTO ............................
(Abbreviated format: ON ERR. G.)
. - I
_F_o_r_m_a_t---,1
Function
ON
ERROR
GOTO Lr
Lr .... Destination line number (entry point of an error processing routine)
This statements causes execution to branch to line number Lr if an error occurs.
The IF ERN and IF ERL statement can be used in a trap routine starting at that line
to control subsequent processing according to the type of error and the line number
in which it occurred. Including a RESUME statement at the end of the error pro-
cessing routine makes it
po.
s sible to return execution to the line at which the error
occurred. Executing an ON ERROR GOTO statement cancels the error trap line
number definied by the previous ON ERROR GOTO statement. The error trap line
number definition is also cancelled by executing a CLR statement.
2.1 0.2 IF ERN
I
Format
I
IF relational expression using
ERN
THEN Lr
Function
Example
IF relational expression using ERN THEN statement
IF relational expression using ERN GOTO Lr
Lr
....
Destination line number
This statement branches execution to the error processing (trap) routine starting at
line
Lr
or executes the statement following THEN when the result of <relational
expression using ERN>
is
true.
ERN is a special function which returns a number corresponding to the type of error
occurring. See page 159 for the error numbers.
·
The following shows an error processing routine beginning on line 1000 which causes
execution to branch to line 1200 if the error number is 5.
1
0
ON
ERROR
GOTO
1
000·· ······
Declares the line number of the
error processing routine.
1
000
IF
ERN=5
THEN
1
200·········Branches
to 1200 if a string
overflow error has occurred.
96 ---------------------------------------------------------------------

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents