%ERLIN

Return the line number of the statement that caused an error

WTSupported in traditional Synergy on Windows
WNSupported in Synergy .NET on Windows
USupported on UNIX
VSupported on OpenVMS
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 for Windows and UNIX desktop and server applications only if the program is built in debug mode. And for x86 systems, if an application is built in debug mode, %ERLIN returns the line number of the next executable line (if one exists) after the line for the requested routine. This is a Microsoft .NET Framework CLR limitation.
  • On device platforms (UWP, Android, iOS), %ERLIN always returns a line value of 0.
Note

On Universal Windows Platform, %ERLIN always returns a line value of 0.

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