This routine sets data items referenced by Variant handles. Note that there is also a C$GETVARIANT routine that retrieves data referenced by a Variant handle.
C$SETVARIANT converts COBOL type data to Variant type data. Programs that call ACUCOBOL-GT using the ACUCOBOL-GT Automation Server or runtime DLL pass their parameters (by reference) as Variant types. The COBOL program receives handles to the Variant data. C$SETVARIANT sets the data associated with a particular handle to the value of a COBOL data item. The data is automatically converted to the proper Variant format.
CALL "C$SETVARIANT" USING SRC-ITEM, H-VARIANT GIVING RESULT-CODE
SRC-ITEM Any COBOL data type | The source data item. |
H-VARIANT USAGE HANDLE | Handle to Variant type data. Data passed in from a program calling ACUCOBOL-GT using the ACUCOBOL-GT Automation Server or runtime DLL is in the form of handles to Variant type data. |
RESULT-CODE Signed numeric value | Receives the result code for the operation. This will be 0 or a positive value to indicate success or a negative value to
indicate failure.
Under Microsoft Windows this is a code of type HRESULT that can be looked up in Microsoft documentation to determine the reason for the failure or additional information about the success. |
The COBOL data item SRC-ITEM is converted to Variant type data, and is stored in the Variant item associated with H-VARIANT.
C$SETVARIANT creates a new variant to store the initial value of the handle item passed to it is LOW-VALUES or SPACES. (It is your responsibility to free this variant using the DESTROY verb.)
The C$SETVARIANT library routine and OLE SAFEARRAY data type are supported in thin client environments, regardless of the kind of operating system on the server. However, be careful when using C$SETVARIANT in thin client environments, because it generates network traffic and can affect performance. When using this library routine in a thin client environment, you should pass only small amounts of data. Note that C$GETVARIANT is not supported in thin client environments at this time.