Sets the user-defined datatype for the specified column.
% INCLUDE SYGWPLI;
01 TDPROC PTR, 01 RETCODE FIXED BIN(31), 01 COLUMN_NUMBER FIXED BIN(31), 01 USER_DATATYPE FIXED BIN(31);
CALL TDSETUDT (TDPROC, RETCODE, COLUMN_NUMBER,
USER_DATATYPE);
(I) Handle for this client/server connection. This must be the same value specified in the associated TDACCEPT call. The TDPROC handle corresponds to the connection and command handles in Open Client Client-Library.
(O) Variable where the result of function execution is returned. Its value is one of the codes listed in Table 3-37.
(I) Number of the column with the datatype that is being set.
(I) The user-defined datatype to be assigned to the specified column.
The RETCODE argument can contain any of the return values listed in Table 3-37.
Return value |
Meaning |
|---|---|
TDS_OK (0) |
Function completed successfully. |
TDS_CONNECTION_TERMINATED (-4997) |
Connection closed. The remote partner closed (deallocated) the client/server connection. |
TDS_ENTRY_NOT_FOUND (-8) |
The specified column number, transaction number, or parameter does not exist. |
TDS_INVALID_PARAMETER (-4) |
Invalid parameter value. The value assigned to one or more of the arguments supplied in the call is not valid. The operation failed. |
TDS_INVALID_TDPROC (-18) |
Error in specifying a value for the TDPROC argument. |
The following code fragment illustrates a typical use of TDSETUDT. This example is taken from the sample program in Appendix B, “Sample RPC Application for CICS.”
/*------------------------------------------------------------------*/
SETUP_REPLY_COLUMNS:
/*------------------------------------------------------------------*/
DB_DESCRIBE_HV_PTR = ADDR(EMPLOYEE_FNM);
DB_COLUMN_NAME_HV_PTR = ADDR(CN_FNM);
WRKLEN1 = STG(EMPLOYEE_FNM)-2;
WRKLEN2 = STG(CN_FNM);
DB_HOST_TYPE = TDSVARYCHAR;
DB_CLIENT_TYPE = TDSVARYCHAR;
CALL DESCRIBE_COLUMN;
/* ------------------------------------------------------------*/
/* Here we let TDESCRIB convert from DB2 varchar (TDSVARYCHAR) */
/* to DBCHAR. */
/* ------------------------------------------------------------*/
DB_DESCRIBE_HV_PTR = ADDR(EMPLOYEE_LNM);
DB_COLUMN_NAME_HV_PTR = ADDR(CN_LNM);
WRKLEN1 = STG(EMPLOYEE_LNM)-2;
WRKLEN2 = STG(CN_LNM);
DB_HOST_TYPE = TDSVARYCHAR;
DB_CLIENT_TYPE = TDSCHAR;
CALL DESCRIBE_COLUMN;
DB_DESCRIBE_HV_PTR = ADDR(EMPLOYEE_ED);
DB_COLUMN_NAME_HV_PTR = ADDR(CN_ED);
WRKLEN1 = STG(EMPLOYEE_ED);
WRKLEN2 = STG(CN_ED);
DB_HOST_TYPE = TDSINT2;
DB_CLIENT_TYPE = TDSINT2;
CALL DESCRIBE_COLUMN;
/* ------------------------------------------------------------*/
/* Get the user defined datatype of EMPLOYEE_ED column. */
/* ------------------------------------------------------------*/
CALL TDINFUDT (GWL_PROC, GWL_RC,
CTR_COLUMN,
GWL_INFUDT_USER_TYPE);
/* ------------------------------------------------------------*/
/* Set the user defined datatype of EMPLOYEE_ED column. */
/* ------------------------------------------------------------*/
CALL TDSETUDT (GWL_PROC, GWL_RC,
CTR_COLUMN,
GWL_INFUDT_USER_TYPE);
Use this function to associate the user-defined datatype with a column when you return that column to the client.
Use TDINFUDT to find out what datatype the client assigned to a given column.
The Gateway-Library datatype for a column is specified by TDESCRIB.
You can query and set the user-defined datatype for a return parameter with TDINFPRM and TDSETPRM.
Related functions