%RCB_CALL

Call a routine using a routine call block

WTSupported in traditional Synergy on Windows

 

USupported on UNIX
VSupported on OpenVMS
result = %RCB_CALL(rcbid)

or

xcall RCB_CALL(rcbid)

Return value

result

The ^VAL result of the Synergy function. This is meaningful only if the routine being called is a ^VAL function. If the routine being called is a subroutine or a non‑^VAL function, result is set to 1. If the routine being called is a non‑^VAL function, the FRETURN value is returned as the first argument of the routine call block argument list.

Arguments

rcbid

The identifier for the routine call block. This is the return value from %RCB_CREATE. (n)

Discussion

%RCB_CALL is used to call a routine once the routine call block is built.

If the function to be called is specified through %RX_SETRMTFNC, a remote call is executed. If the function to be called is specified through %RCB_SETFNC, a local call is executed. When %RCB_CALL is used to call a remote routine, all arguments specified as ^VAL are passed as an integer, and all arguments specified as ^REF have the data passed according to the type and length specified in the %RCB_SETARG call. If an argument has not been specified, it is passed as a null argument.

See also

Defining a parameter.

Examples

subroutine ABC
    arg1,   n
    arg2,   n
proc
    arg1 = arg1 + arg2
    xreturn
endsubroutine
 
function DEF
    arg1,   n
    arg2,   n
proc
    freturn(arg1 + arg2)
endfunction
 
function GHI, ^VAL
    arg1,   n
    arg2,   n
proc
    freturn(arg1 + arg2)
endfunction
 
subroutine JKL
    rcbid,      i4
    a,          i4
    b,          i4
    result,     i4
    value,      i4
proc
    a = 3
    b = 4
    rcbid = %rcb_create(2)
    xcall rcb_setfnc(rcbid, "ABC")
    xcall rcb_setargs(rcbid, 1, a, b)
    result = %rcb_call(rcbid)           ;result = 1, a = 7, b = 4
    xcall rcb_delete(rcbid)
    a = 3
    b = 4
    rcbid = %rcb_create(3)
    xcall rcb_setfnc(rcbid, "DEF")
    xcall rcb_setargs(rcbid, 1, result, a, b)
    value = %rcb_call(rcbid)            ;value = 1, result = 7, a = 3, b = 4
    xcall rcb_delete(rcbid)
    a = 3
    b = 4
    rcbid = %rcb_create(2)
    xcall rcb_setfnc(rcbid, "GHI")
    xcall rcb_setargs(rcbid, 1, a, b)
    result = %rcb_call(rcbid)           ;result = 7, a = 3, b = 4
    xcall rcb_delete(rcbid)
    xreturn
endsubroutine