TDSETLEN

Description

Sets the column length for a variable-length field before sending it to a client.

Syntax

% INCLUDE SYGWPLI;
01 TDPROC            PTR,
01 RETCODE           FIXED BIN(31),
01 COLUMN_NUMBER     FIXED BIN(31),
01 NEW_COLUMN_LENGTH FIXED BIN(31);
CALL TDSETLEN	(TDPROC, RETCODE, COLUMN_NUMBER, 
                 NEW_COLUMN_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-30.

COLUMN_NUMBER

(I) The number of the column that is being described. Columns are numbered sequentially; the first column in a row is number 1.

NEW_COLUMN_LENGTH

(I) New length of the column data. This argument specifies the length of the data that is sent in subsequent TDSNDROW calls. This value must be greater than zero but cannot be greater than the maximum length of the column, as determined by TDESCRIB.

Returns

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

Table 3-30: TDSETLEN return values

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_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_LENGTH (-173)

Wrong length. The length specified in the NEW_COLUMN_LENGTH argument is too long.

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.

Examples

Example 1

The following code fragment illustrates a typical use of TDSETLEN. This example is taken from the sample program in Appendix B, “Sample RPC Application for CICS.”

	/* -----------------------------------------------------------*/
	/*      Do not send trailing blanks of EMPLOYEE_LNM 
	/* -----------------------------------------------------------*/
              WRKLEN1 = LENGTH(EMPLOYEE_LNM);
              CTR_COLUMN = 2;
              WRK_BLANKS_SS = 1;
	LOOP:       DO WHILE(WRK_BLANKS_SS <= WRKLEN1);
                IF SUBSTR(EMPLOYEE_LNM, WRK_BLANKS_SS, 1) = ' ' THEN DO;
                  LEAVE LOOP;
                END;
                WRK_BLANKS_SS = WRK_BLANKS_SS + 1;
              END LOOP;
              IF (WRK_BLANKS_SS <= WRKLEN1) THEN DO;
                CALL TDSETLEN (GWL_PROC, GWL_RC,
                               CTR_COLUMN,
                               WRK_BLANKS_SS - 1);
              END;

Usage


TDSETLEN

A server application uses this function to specify the length of data for a single column, before it is sent to the client.

See also

Related functions