%SYSERR

Return the status code from the last system call

WTSupported in traditional Synergy on Windows
WNSupported in Synergy .NET on Windows
USupported on UNIX
VSupported on OpenVMS
status = %SYSERR

Return value

status

The operating system error code from the last system call performed by the runtime. (i)

Discussion

%SYSERR is a partial alternative to the ERROR subroutine.

Note that if an error is trapped and your program performs I/O operations or calls an XCALL that requires system service before it calls %SYSERR, when %SYSERR is finally called, it contains the “success” status code from the I/O operation or XCALL, rather than the failure code from the last error.

Tip

All I/O statements, some other statements, and many subroutines update the value returned by %SYSERR. When a system error is detected, we recommend that you use %SYSERR to capture the error immediately, before it is updated by subsequent statements and subroutines, and then store it in a local variable for later processing.

On Synergy .NET, %SYSERR is only used for the system error code for system-supplied subroutines, functions, and I/O statements.

Consider using %IO_ERROR as a substitute for %SYSERR.

Examples

    reads(chan, data) [err=ioerr]
    return
ioerr,
    writes(1, "system error: " = %hex(%syserr))