Retrieves information about the client-defined datatype for a column.
COPY SYGWCOB.
01 TDPROC PIC S9(9) USAGE COMP SYNC. 01 RETCODE PIC S9(9) USAGE COMP SYNC. 01 COLUMN-NUMBER PIC S9(9) USAGE COMP SYNC. 01 USER-DATATYPE PIC S9(9) USAGE COMP SYNC.
CALL 'TDINFUDT' USING 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, SYCCSAR2, in Appendix B, “Sample RPC Application for CICS.”
* Here we let TDESCRIB convert from DB2 varchar (TDSVARYCHAR) * to DBCHAR.
CALL 'SYGETAD' USING DB-DESCRIBE-HV-PTR, EMPLOYEE-ED. CALL 'SYGETAD' USING DB-COLUMN-NAME-HV-PTR, CN-ED. MOVE LENGTH OF EMPLOYEE-ED TO WRKLEN1. MOVE LENGTH OF CN-ED TO WRKLEN2. MOVE TDSINT2 TO DB-HOST-TYPE. MOVE TDSINT2 TO DB-CLIENT-TYPE. PERFORM DESCRIBE-COLUMN.
* Get the user defined datatype of EMPLOYEE-ED column. CALL 'TDINFUDT' USING GWL-PROC, GWL-RC, CTR-COLUMN, GWL-INFUDT-USER-TYPE. * Set the user defined datatype of EMPLOYEE-ED column. CALL 'TDSETUDT' USING GWL-PROC, GWL-RC, CTR-COLUMN, GWL-INFUDT-USER-TYPE.
*----------------------------------------------------------------- DESCRIBE-COLUMN. *----------------------------------------------------------------- SET ADDRESS OF LK-DESCRIBE-HV TO DB-DESCRIBE-HV-PTR. SET ADDRESS OF LK-COLUMN-NAME-HV TO DB-COLUMN-NAME-HV-PTR. ADD 1 TO CTR-COLUMN. CALL 'TDESCRIB' USING GWL-PROC, GWL-RC, CTR-COLUMN, DB-HOST-TYPE, WRKLEN1, LK-DESCRIBE-HV, DB-NULL-INDICATOR, TDS-FALSE, DB-CLIENT-TYPE, WRKLEN1, LK-COLUMN-NAME-HV, WRKLEN2.
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. |
![]() |