CTBGETFORMAT

Description

Returns the user-defined format for a result column.

NoteThis function is used with requests to Adaptive Server Enterprise only.

Syntax

%INCLUDE CTPUBLIC;
DCL
     01 COMMAND         FIXED BIN(31) INIT(0);
     01 RETCODE          FIXED BIN(31) INIT(0);
     01 COLUMN_NUM  FIXED BIN(31) INIT(1);
     01 BUFFER             FIXED BIN(31);
     01 BUFFER_LEN    FIXED BIN(31);
     01 OUTLEN            FIXED BIN(31);
 
CALL CTBGETFO (COMMAND, RETCODE, COLUMN_NUM, BUFFER, BUFFER_LEN, OUTLEN); 

Parameters

COMMAND

(I) Handle for this client/server operation. This handle is defined in the associated CTBCMDALLOC call.

RETCODE

(O) Variable where the result from an executed function returns. Its value is one of the codes listed under “Returns,” in this section.

COLUMN_NUM

(I) Number of the column for which the user-specified format is desired.

COLUMN_NUM refers to the select-list ID of the column. The first column in the select list of a select statement is column number 1, the second is column number 2, and so forth.

BUFFER

(O) Variable (“buffer”) in which CTBGETFORMAT places the requested information.

This argument is typically:

	01 BUFFER 	CHAR(n);
BUFFER_LEN

(I) Length, in bytes, of the buffer.

If BUFFER_LEN is too small to hold the requested information, CTBGETFORMAT sets OUTLEN to the length of the requested information, and returns CS_FAIL.

OUTLEN

(O) Length, in bytes, of the format string. OUTLEN is an integer variable where CTBGETFORMAT returns the total number of bytes being retrieved.

When the format string is larger than BUFFER_LEN bytes, an application uses this value to determine how many bytes are needed to hold the string.

If a format string is not associated with the specified column, CTBGETFORMAT sets OUTLEN to 0.

Returns

CTBGETFORMAT returns one of the following values:

Value

Meaning

CS_SUCCEED (-1)

The routine completed successfully.

CS_FAIL (-2)

The routine failed.

TDS_INVALID_PARAMETER (-4)

One of the CTBGETFORMAT arguments contains an illegal value.

Usage

See also

Related functions: