11 - 63 11 - 63
MELSEC-Q
11 INSTRUCTIONS AND FUNCTIONS
ERL
Function
ERror Line
• Returns the line number where an error was detected.
Syntax
ERL
Examples
E=ERL
• • • •
Stores the line number where the error was detected
to E.
Description
• The ERL function returns the line number where the error was detected when an error has
occurred.
• The ERL function is used in the error processing routine so that the processing branches
depending on the line where the error occurred.
• If the instruction that caused the error was being executed in the direct mode, the ERL
function returns 65535.
• The ERL function has a limited purpose and it cannot be specified on the left side of the
equal sign in the LET instruction and some other places.
Program Example
10 ' Displays the line number where the error occurred
20 ON ERROR GOTO 100
:
' Branches to line 100 when an error occurs
50 ERROR 10
:
' <-- Error occurs at this line
60 END
100 PRINT "ERROR LINE =";ERL
:
' Displays the line number where the error
occurred
110 RESUME 60
RUN
ERROR LINE = 50
OK
REMARK
See the ON ERROR GOTO and RESUME instructions, ERR function, and Chapter 9.