XRETURN

Return control to a calling routine

WSupported on Windows
USupported on Unix
VSupported on OpenVMS
NSupported in Synergy .NET
XRETURN [return_value]

return_value

(optional) A ^VAL value to be returned to the caller. In an external subroutine, this value can be retrieved using XSTAT. It can also be retrieved by declaring the subroutine as a ^VAL function and returning return_value as the function return value. A C routine can also retrieve the return value from XRETURN. (n) (traditional Synergy only)

The XRETURN statement returns control to the calling routine from an external subroutine. Any internal CALLs in the subroutine are disregarded; in other words, you don’t have to RETURN from them before XRETURNing to the calling routine.

XRETURN cannot be used in a main routine or a function. If the compiler encounters an ­XRETURN statement outside of a subroutine, it generates an error.

The following example shows an external subroutine that uses XRETURN.

subroutine choice
    a_data              ,a
external function 
    decide              ,d
proc
    repeat
      begin
        case %decide(a_data) of
          begincase
            writes(TTCHN, "processing result #1")
            writes(TTCHN, "processing result #2")
            writes(TTCHN, "processing result #3")
          endcase
        else
          writes(TTCHN, "... invalid result")
      end
    xreturn
endsubroutine