%RCB_CREATE

Create a routine call block

WSupported on Windows
USupported on Unix
VSupported on OpenVMS

 

id = %RCB_CREATE(numargs, [flags][, old_rcbid])

Return value

id

The ID of the created routine call block. (n)

Arguments

numargs

The number of arguments to reserve space for initially. Zero is a valid value, indicating that the argument list contains no arguments. (n)

flags

(optional) One or more of the following: (n)

DM_STATIC = Make the routine call block ID persistent to all routines.

DRCB_REPLICATE = Replicate the caller’s argument list.

old_rcbid

(optional) A previously created call block that can now be reused. (n)

Discussion

%RCB_CREATE creates a routine call block in the size specified.

Note that numargs specifies only the number of arguments; the arguments are not present until they are added with RCB_SETARG or RCB_SETARGS.

DRCB_REPLICATE can be added to DM_STATIC (DM_STATIC+DRCB_REPLICATE) to duplicate the caller’s argument list and make the routine call block persistent until it is explicitly deleted. If DRCB_REPLICATE is specified and remote execution is attempted, all arguments are assumed to be passed by descriptor. An explicit RCB_SETARG done for each ^VAL and ^REF argument for remote execution. If DM_STATIC is not set, the routine call block ID is local to this routine and is cleaned up automatically without a call to RCB_DELETE when the current routine exits via FRETURN or XRETURN.

Specifying old_rcbid enables you to reuse a block that is no longer needed. The old information is released, and the block is initialized to hold the number of arguments specified.

Examples

record
    rcbid       ,i4
    arg_1       ,a3
proc
    rcbid = %rcb_create(1)                      ;Create an RCB block with 1 arg
    xcall rcb_setarg(rcbid, arg_1, 1)           ;Set up arg_1 as argument #1
    xcall rcb_setfnc(rcbid, "routine")          ;Set function to be called
    xcall rcb_call(rcbid)                       ;Call function as xcall routine(arg_1)
    xcall rcb_delete(rcbid)                     ;Delete RCB block
end

Also see %RCB_CALL Examples.