Retrieves information about the client-defined datatype for a column.
%INCLUDE SYGWPLI;
01 TDPROC PTR, 01 RETCODE FIXED BIN(31), 01 COLUMN_NUMBER FIXED BIN(31), 01 USER_DATATYPE FIXED BIN(31);
CALL TDINFUDT (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-21.
(I) Number of the column with the datatype that is being queried. Columns are numbered sequentially; the first column in a row is number 1.
(O) Variable where the user-defined datatype is returned. This can be any datatype assigned to the column by a client.
The RETCODE argument can contain any of the return values listed in Table 3-21.
Return value |
Meaning |
---|---|
TDS_OK (0) |
Function completed successfully. |
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 TDINFUDT. 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 determine the datatype defined for a column by the client. When your application returns results to the client, it can specify the user-defined datatype for that column with the function TDSETUDT.
The user-defined datatype is a tag associated with a column by the client. It is not the TDS datatype of the column, which is specified in the TDESCRIB call.
You can query and set the user-defined datatype for a return parameter with TDINFPRM and TDSETPRM.
Related functions
Copyright © 2005. Sybase Inc. All rights reserved. |
![]() |