Your client program calls a rule by specifying CALLRULE as the OPERATION parameter and a string consisting of the rule name as the PARM parameter. If the rule takes arguments, the rule name is followed by the values for the arguments in parentheses. The DATA-IN (the fifth) and the DATA-OUT (the sixth) parameter are specified as described below. The RETURN-DATA (the seventh) parameter is set to any message that is returned by ENDMSG when the RETURN-CODE parameter is 0.
The DATA-IN and the DATA-OUT areas can have one of two formats and describe one or more blocks of storage. In all cases, the client program is responsible for allocating storage, and for storage blocks pointed to by their structure.
The DATA-IN and the DATA-OUT areas are mapped by the same structure. The structure is used to represent a list of blocks (or COMMAREAs). The structure contains a count of the number of blocks, location and size.
The storage blocks are in separate locations, and are pointed to by addresses. This technique is not well-supported by the COBOL language, but works well in assembler.
From your rules code, you can obtain the address of the DATA-IN block list by using the value of the field APIINHANDLE of the System Interpreted Table
@SESSION(0). Similarly, you can obtain the address of the DATA-OUT block list using the value of the field APIOUTHANDLE of
@SESSION(0). Access to the storage referenced by MAP tables is always granted and there is no need to register these addresses in the @MAP table. APIINHANDLE memory is accessible for reading and APIOUTHANDLE for reading and writing.
You can also use the $GETENVCOMMAREA and
$SETENVCOMMAREA tools to access the blocks of storage in the DATA-IN and DATA-OUT areas.
Since the user client is responsible for allocating storage for the DATA-IN and DATA-OUT block lists, changing the value for APIINHANDLE and APIOUTHANDLE is not supported. The contents of the block lists can, however, be modified by rules code using MAP tables.
The following rule fragment assigns the address of the DATA-OUT block list to local variable OUT, and the address of the DATA-IN block list to local variable IN:
These examples call the ABC rule with the two arguments: 1 and SCR. They pass in one commarea via DATA-IN and expect up to 80 bytes of data to be returned in DATA-OUT.
Whenever a non-zero value is returned in RETURN-CODE, RETURN-DATA contains either a reason code or an error message. The reason code is indicated by binary zeros in the first byte of RETURN-DATA; otherwise, RETURN-DATA contains a short error message similar to the ENDMSG that is returned to the workbench.
TIBCO Object Service Broker Shareable Tools about the tools and System Interpreted Tables.