ERL
Returns the line
number
in which an errorhas occurred. This function is primarily
usedinside an error-handling routine accessed by an
ON
ERROR
GOTO
statement.
If
noerrorhas occurred
when
ERL
is called, line numberais returned. However,
if
an
errorhas occurred since power-up,
ERL
returns the line numberin which the error
occurred.
If
erroroccurred in direct mode, 65535 is returned (largest
number
representable
in
two
bytes).
Example
Program
using ERL
10
CLEAR
10
20
ON
ERROR
GOTO
1000
30
I NPIJ'r "ENTER
YOUF<
1"°IFt::;E;.<\GE:":;
l'il~;
40
INPUT
"NOW
ENTER
A
NUMBER";
N
50
Z
::::
1
IN
60
PRINT
"INPUT
VALUES
OKAY--TRY
AGAIN
TO
CAUSE
AN
ERROR"
70
GOIO
]0
1000
IF
ERL=30
AND
(ERR/2 + 1 -
14)
THEN
1040
1010
IF
ERL=40
AND
(ERR/2 + 1 -
6)
THEN
1050
1020
IF
ERL=50
AND
(ERR/2 + 1 -
11)
THEN
1060
1030
ON
ERROR
GOTO
0:
RESUME
1040
PRINT
"MESSAGE
TOO
LONG--10
LETTERS
MAXIMUM":
RESUME
1050
PRINT
"NUMBER
TOO
LARGE":
RESUME
1060
PRINT
"DIVISION
BY
ZERO
IN
LINE
50--ENTER
NON-ZERO
NUMBER"
1070
RESUME
'+0
RUN
the program.
Try
entering a long message; try entering zero when the program
asks for a number. Notethat
ERL
is used in line 1000to determine where the error
occurredso thatappropriate action
may
be taken.
ERR/2+1
Similarto
ERL,
except
ERR
returns a value related to the code
of
the error rather
than the line in
which
the erroroccurred.
It
is commonly used inside an error
handling routine accessed by an
ON
ERROR
GOTO
statement. See Appendix B,
,
'Error
Codes.' ,
ERR/2
+ 1=trueerrorcode
(true error
code
- 1)*2 =
ERR
Sample
Program
SeeERL.
8/3