[next] [previous] [contents]

  16.2.5.2 Determining the Error Line Number (ERL)
  After your program generates an error, the ERL function
  returns the BASIC line number of the signaled error. This
  function is valid only in line-numbered programs. The ERL
  function, like ERR, lets you set up branching to one of several
  paths in the code.

  In the following example, the handler continues execution at
  different points in the program, depending on the value of
  ERL:
  
EXAMPLE: Click to display example.

  The results of ERL are undefined until an error occurs, or
  if the error occurs in a subprogram not written in BASIC.
  Although ERL remains defined as the line number of the last
  error even after control leaves the error handler, it is poor
  programming practice to refer to this variable outside the
  scope of an error handler.

  If you reference ERL in a compilation unit with line num-
  bers, code and data are included in your program to allow
  BASIC to determine ERL when an exception occurs. If you
  do not need to reference ERL, you can save program size and
  reduce execution time by compiling your program with the
  /NOLINE qualifier. DEC BASIC uses the /NOLINE qualifier
  by default to compile programs. Even if you do not use any
  line numbers, you can reduce execution time by compiling
  with the /NOLINE qualifier.

  If an error occurs in a subprogram containing line numbers,
  BASIC sets the ERL variable to the subprogram line number
  where the error was detected. If the subprogram also exe-
  cutes an EXIT HANDLER statement, control passes back to
  the outer procedure's handler. The error is assumed to occur
  on the statement where the call or invocation occurs.