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


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


%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.


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 (see %IO_ERROR) as a substitute for %SYSERR.


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