%ERLIN

Return the line number of the statement that caused an error

WSupported on Windows
USupported on Unix
VSupported on OpenVMS
NSupported in Synergy .NET
line = %ERLIN

Return value

line

The line number of the statement that caused the most recent trappable error. (n)

Discussion

%ERLIN is identical to DIBOL’s %ERLINE, and you can substitute one for the other.

Note

The %ERLIN routine is not supported in multi-threaded scenarios, and you must use TRY-CATCH under these circumstances.

Important

With Synergy .NET, line has the following restrictions:

  • Line number information is accurate only if the program is built in debug mode. For x86 systems, if an application is built in debug mode, %ERLIN may return the line number of the next executable line (if one exists). This behavior is unstable across .NET versions and platforms.
  • Line is ignored when using an I/O error list.

Examples

The following routine displays the most recent Synergy DBL error number, text, and line number.

subroutine proc_error
.define TTCHN           ,1
record
    msg                 ,a45
proc
    xcall ertxt(%ernum, msg)
    writes(TTCHN, "Error#" + %string(%ernum) + ": " msg +
  &        " at line " + %string(%erlin))
    return
endsubroutine