Open topic with navigation
WTSupported in traditional Synergy on Windows
WNSupported in Synergy .NET on Windows
USupported on UNIX
VSupported on OpenVMS
xcall XSTAT([return_value], [bit0], [severity], [message], [facility][, control])
(optional) The variable that will be loaded with the return value of the last function or subroutine called. On OpenVMS, this argument is optional and corresponds to the full 32‑bit return status value. It must be 10 digits wide to avoid overflow. (n)
(optional) A field that corresponds to the value of the low bit of the return value. (n)
(optional) A field that corresponds to the value of bits 0 through 2 of the return value. (n)
(optional) A field (five digits wide to avoid overflow) that corresponds to the value of bits 3 through 15 of the return value. (n)
(optional) A field (five digits wide to avoid overflow) that corresponds to the value of bits 16 through 27 of the return value. (n)
(optional) A field that corresponds to the value of bits 28 through 31 of the return value. (n)
The XSTAT subroutine gets the return value from any of the following:
The return value from a user‑defined subroutine that does not XRETURN a return value is one.
The return value from a Synergy DBL system‑supplied subroutine or non‑^VAL function is zero. The SPAWN and SHELL subroutines are exceptions to this rule.
On Synergy .NET, XSTAT is only supported after a call to SPAWN or SHELL.
On OpenVMS, any of the arguments to the XSTAT subroutine can be passed as null arguments.
The following example verifies an ISAM file and stops the program if the ISAM file is corrupt.
subroutine chkism a_file ,a record vfycmd ,a*, "isutl -v " vfile ,a40 record rtnval ,d1 proc vfile = a_file xcall spawn(vfycmd) xcall xstat(rtnval) if (rtnval) begin writes(TTCHN, "ISAM file " + vfile + " corrupt") xcall cleanup stop end xreturn endsubroutine
The following example illustrates how to use XSTAT to retrieve the ^VAL return value from an external subroutine. This return value is an integer value of the natural integer size of the machine. (That is, for a 32‑bit machine, it is an i4; for a 64‑bit machine, it is an i8.) See Writing and calling subroutines and functions for additional information.
main record retval ,i4 proc xcall mult(3, 4) ;Call mult subroutine xcall xstat(retval) ;Retrieve the ^VAL return value endmain subroutine mult a_arg1 ,n a_arg2 ,n record result ,i4 proc result = a_arg1 * a_arg2 xreturn result ;Return the result as a ^VAL value endsubroutine