Data Conversion

Exercise caution in choosing arguments of appropriate type and size. The mechanism for passing arguments for the DAL functions does not perform extensive checking, such as whether the arguments are properly sized or meaningfully typed.

GT.M interprets arguments passed by a numeric descriptor, for example, DSK$K_DTYPE_L or DSK$K_DTYPE_W type descriptors to a DAL function as numbers. GT.M interprets arguments passed by means of string descriptors as strings, unless the argument provides a subscript and contains an M canonical number. In this case, GT.M converts the string to numeric format.

GT.M interprets arguments passed by a numeric descriptor, (e.g., GTM_LONG or GTM_SHORT type descriptors to a DAL function as numbers). GT.M interprets arguments passed by means of string descriptors as strings, unless the argument provides a subscript and contains an M canonical number. In this case, GT.M converts the string to numeric format.

GT.M converts arguments passed by a numeric descriptor out of a DAL function from string to number. GT.M returns arguments passed by string descriptors out of a DAL function using the GTM_ARRAY_OF_CHARS descriptors, with CLASS_D (dynamic) or CLASS_S (static). In the case of static strings, if the descriptor specifies a destination shorter than the M string, the database function truncates the output. If the descriptor specifies a destination longer than the M string, the database function pads the destination with NULLS.

In addition, for descriptor arguments with read-only access method, GT.M might need to do type conversion of the input argument type to GT.Ma??s desired data type as well as for descriptor arguments with write-only access method, GT.M might need to do type conversion of its data type to the desired argument type. For these type conversions, it uses the VMS run-time library routine LIB$CVT_DX_DX. Refer to "VMS Run-Time Library" manual for details on the conversion.

If a write-only access method fixed length (DSC$K_CLASS_S) argument descriptor specifies a destination that is shorter than the M string returned by the database function, GT.M truncates the output. If the same argument descriptor specifies a destination that is longer than the M string, GT.M pads the destination with NULLs.

If a write-only access method dynamic string (DSC$K_CLASS_D) argument descriptor specifies a destination that is not equal to the length of the M string returned by the database function, GT.M frees up any string that the descriptor already points to, and allocates a string that can hold the M string.

The recommended way to return a string is with a dynamic string descriptor. Initialize the destination either with LIB$CVT_DX_DX or by establishing a DSK$K_CLASS_D (dynamic string class), DSK$K_DTYPE_T (character string type) descriptor that has a length of zero (0) and a NULL string pointer.

The recommended way to return a string is with a dynamic string descriptor. Initialize the destination either with LIB_CVT_DX_DX or by establishing a CLASS_D, GTM_ARRAY_OF_CHARS (character string) descriptor that has a length of zero (0).