TDYNAMIC

Description

Reads or responds to a client dynamic SQL command.

Syntax

Copy SYGWCOB.

01 TDPROC             PIC S9(9) USAGE COMP SYNC.
01 RETCODE            PIC S9(9) USAGE COMP SYNC.
01 CMD                PIC S9(9) USAGE COMP SYNC. 
01 ITEM               PIC S9(9) USAGE COMP SYNC. 
01 HOST-VARIABLE      PIC X(n).
01 HOST-VAR-LENGTH    PIC S9(9) USAGE COMP SYNC.
01 ACTUAL-DATA-LENGTH PIC S9(9) USAGE COMP SYNC.
CALL ‘TDYNAMIC’ USING TDPROC, RETCODE, CMD, ITEM,
                HOST-VARIABLE. HOST-VAR-LENGTH, 
                ACTUAL-DATA-LENGTH.

Parameters

TDPROC

(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.

RETCODE

(O) Variable where the result of function execution is returned. Its value is one of the codes listed in Table 3-47.

CMD

(I) Gets (TDS-GET) or sets (TDS-SET) the value of a particular item.

ITEM

(I/O) Indicates what kind of information is being sent or retrieved. ITEM can be one of the following values listed in Table 3-45.

Table 3-45: ITEM argument values

Value

Notes

TDS-DYN-TYPE

Legal values for TDS-DYN-TYPE when CMD is TDS-GET: TDS-PREPARE TDS-DESCRIBE-INPUT TDS-DESCRIBE-OUTPUT TDS-EXECUTE TDS-EXEC-IMMEDIATE TDS-DEALLOC When CMD is TDS-SET, TDS-DYN-ACK is the only valid value.

TDS-DYN-IDLEN

The length of the dynamic statement ID.

TDS-DYN-ID

The dynamic statement ID.

TDS-DYN-STMTLEN

The length of the dynamic statement.

TDS-DYN-STMT

The dynamic statement that is being prepared or executed.

HOST-VARIABLE - (I/O) – Buffer in which ITEM value is returned (TDS-GET) or set (TDS-SET).

HOST-VAR-LEN - (I/O) – The length in bytes of HOST-VARIABLE. This value varies depending on the value of ITEM. The possible values are listed in Table 3-46.

Table 3-46: HOST-VAR-LEN values

Value

Notes

TDS-DLYN-TYPE (4)

TDS-DYN-IDLEN (4)

TDS-DYN-ID

Depends on the size of ID (maximum is 255)

TDS-DYN-STMTLEN (4)

TDS-DYN-STMT

Depends on the size of dynamic statement

Returns

The RETCODE argument can contain any of the return values listed in Table 3-47.

Table 3-47: TDYNAMIC return values

Return value

Meaning

TDS-DYNSQL-ALREADY-DEALLOCATED (-84)

Dynamic SQL request already allocated. You cannot deallocate a dynamic SQL request that is already allocated.

TDS-DYNSQL-ALREADY-PREPARED (-81)

Dynamic SQL request already prepared. You cannot prepare a dynamic SQL request that is already deallocated.

TDS-DYNSQL-ID-NOT-FOUND (-85)

Dynamic SQL request not found.

TDS-DYNSQL-IDLEN-TOO-LONG (-87)

Dynamic SQL request ID length is greater than 255.

TDS-DYNSQL-NO-STMT-GIVEN (-86)

No SQL statement is associated with the dynamic SQL request.

TDS-DYNSQL-NOT-PREPARED (-80)

A dynamic SQL request is not prepared.

TDS-DYNSQL-OUTPUT-ALREADY-DEFINED (-83)

Dynamic SQL output already defined. You cannot define dynamic SQL output more than once.

TDS-DYNSQL-PARMS-ALREADY-DEFINED (-82)

Dynamic SQL parameters already defined. You cannot define dynamic SQL parameters more than once.

TDS-DYNSQL-STMT-NOT-FOUND (-89)

No SQL statement is associated with the dynamic SQL request.

TDS-INVALID-BOOLEAN (-180)

Invalid Boolean value. Boolean values must be set to either CS-TRUE or CS-FALSE.

TDS-INVALID-CURCLOSOPTION (-182)

A “closed” cursor command specified an invalid option. The Gateway-Library transaction received a “closed” cursor command, but the value of the OPTION field of the CURSOR-DESC structure is invalid. Valid options are TDS-CUR-UNUSED and TDS-CUR-DEALLOC.

TDS-INVALID-CURDECLOPTION (-183)

A declare cursor command has an invalid option specified. The Gateway-Library transaction received a declare cursor command, but the value of the OPTION field of the CURSOR-DESC structure is invalid. Valid options are TDS-CUR-UNUSED and TDS-CUR-DEALLOC.

TDS-INVALID-CURDECLSTAT (-184)

Illegal cursor declare option.

TDS-INVALID-CURINFCMD (-195)

Illegal cursor information command.

TDS-INVALID-CUROPENSTAT (-187)

Illegal cursor open status.

TDS-INVALID-CURUPDSTAT (-186)

Illegal cursor update status.

TDS-INVALID-DATA-CONVERSION (-172)

Incompatible datatypes. The source datatype cannot be converted into the requested result datatype.

TDS-INVALID-DATA-TYPE (-171)

Illegal datatype. A Sybase datatype supplied in the call is not supported and the conversion cannot be done. The operation failed.

TDS-INVALID-DATAFMT-VALUE (-181)

One or more values specified for fields in the DATAFMT structure are illegal.

TDS-INVALID-DYNSQL-FSM (-79)

Dynamic SQL request in invalid state.

TDS-INVALID-DYNSTAT (-188)

Invalid status for dynamic SQL request.

TDS-INVALID-DYNTYPE (-189)

Invalid type for dynamic SQL request.

TDS-INVALID-FLAGS (-176)

Invalid padding option for a field.

TDS-INVALID-LENGTH (-173)

Wrong length. The length specified in the HOST-VAR-LEN argument is too long.

TDS-INVALID-NAMELENGTH (-179)

Invalid name length. The length specified for the column, parameter, message, or server name is invalid.

TDS-INVALID-PRECISION (-177)

Invalid precision value. The precision value specified during conversion of TDS-PACKED-DECIMAL data is invalid.

TDS-INVALID-SCALE (-178)

Invalid scale value. The scale value specified during conversion of TDS-PACKED-DECIMAL data is invalid.

TDS-INVALID-STATUS (-174)

Invalid status value. The value entered in the STATUS field is invalid.

TDS-INVALID-VAR-ADDRESS (-175)

Specified variable address is invalid. No variable with the specified name exists. A NULL value was specified. The operation failed.

See also

Related topics