Sets the user-defined datatype for the specified 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 'TDSETUDT' 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-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, 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 TDSETUDT 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
Copyright © 2005. Sybase Inc. All rights reserved. |
![]() |