bas7advr.hlp (
Topic list)
ERR, ERL Functions Details
◄Syntax► ◄Details► ◄Example► ◄Contents► ◄Index► ◄Back►
──────────────────────────────────────────────────────────────────────────────
Return error status.
ERR and ERL
Usage Notes
■ After an error, the function ERR returns the latest setting of the
runtime error code, and the ERL function returns the line number
where the error occurred. Because ERR and ERL return meaningful
values only after an error, they are usually used in error-handling
routines to determine the error and the corrective action.
■ The value returned by the ERR function can be directly set by
using the ERR statement. Both the values returned by ERR and ERL may
be set indirectly with the ERROR statement.
■ The ERL function returns only the line number, not line labels,
located before the line producing the error. If your program has no
line numbers, or there is no line number in the program before the
point where the error occurred, ERL returns 0.
■ ERL values differ between programs compiled with BC and those run
under QBX. In programs compiled with BC, ERL is set to the last
numbered line in the source file preceding the line where the error
occurred. When QBX detects an error in a procedure, it looks for a
line number only within the immediate procedure. If the procedure
doesn't contain a numbered line, QBX returns 0 for ERL. You can make
your programs run identically with both BC and QBX by always
including a line number at the beginning of a procedure where an
error might occur.