advr.hlp (Topic list)
Important Notice
The pages on this site contain documentation for very old MS-DOS software, purely for historical purposes. If you're looking for up-to-date documentation, particularly for programming, you should not rely on the information found here, as it will be woefully out of date.
ERR, ERL Function Details
  Summary  Details  Example                Contents  Index  Back
──────────────────────────────────────────────────────────────────────────────
 ERR
 ERL
 
 Usage Notes
   ■ After an error, the ERR function returns the latest setting of the run-
     time 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.
 
   ■ You can directly set the value returned by the ERR function using the
     ERR statement. The values returned by both ERR and ERL can be set
     indirectly with the ERROR statement.
 
   ■ The ERL function returns only the line number (not a line label) located
     at or before the line producing the error. If your program has no line
     numbers, or if there is no line number in the program before the point
     where the error occurred, ERL returns 0.
 
   ■ ERL values in programs compiled with BC differ from those run under
     VBDOS:
     • 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 VBDOS detects an error in a procedure, it looks for a line number
       only in the immediate procedure. If the procedure doesn't contain a
       numbered line, VBDOS returns 0 for ERL.
 
   ■ You can make your programs run identically with both BC and VBDOS by
     always including a line number at the beginning of a procedure where an
     error might occur.