TDINFPGM

Description

Retrieves information about the current client request.

Syntax

%INCLUDE SYGWPLI;
01 TDPROC             PTR,
01 RETCODE            FIXED BIN(31),
01 TDS_VERSION        FIXED BIN(31),
01 LONGVAR_TRUNC_FLAG FIXED BIN(31),
01 ROW_LIMIT          FIXED BIN(31),
01 REMOTE_TRACE_FLAG  FIXED BIN(31),
01 USER_CORRELATOR    FIXED BIN(31),
01 DB2GW_OPTIONS      FIXED BIN(31),
01 DB2GW_PID          CHAR(8),
01 REQUEST_TYPE       FIXED BIN(31);
CALL TDINFPGM (TDPROC, RETCODE, TDS_VERSION,
	 LONGVAR_TRUNC_FLAG, ROW_LIMIT,
	 REMOTE_TRACE_FLAG, USER_CORRELATOR,
	 DB2GW_OPTIONS, DB2GW_PID,
	 REQUEST_TYPE);

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

TDS_VERSION

(O) Variable where the version of TDS being used is returned. The version can be any of the values listed in Table 3-15. This value must be the same as the version level specified at the client.

Table 3-15: TDS_VERSION values

TDS_VERSION2_0

FIXED BIN(31)

INIT(512)

TDS_VERSION3_4

FIXED BIN(31)

INIT(832)

TDS_VERSION4_0

FIXED BIN(31)

INIT(1024)

TDS_VERSION4_2

FIXED BIN(31)

INIT(1056)

TDS_VERSION4_6

FIXED BIN(31)

INIT(1120)

TDS_VERSION4_8

FIXED BIN(31)

INIT(1152)

TDS_VERSION4_9

FIXED BIN(31)

INIT(1168)

TDS_VERSION5_0

FIXED BIN(31)

INIT(1280)

TDS_VERSION5_1

FIXED BIN (31)

INIT(1296)

LONGVAR_TRUNC_FLAG

(O) Variable where the truncation indicator for TDSLONGVARCHAR fields is returned. It indicates what happens when any TDSLONGVARCHAR fields over 255 characters are returned to the client.

One of the following values is returned in this variable:

TDS_TRUE (1)

TDSLONGVARCHAR fields are truncated.

TDS_FALSE (0)

TDSLONGVARCHAR fields are not truncated; an error is returned instead.

If 0 is specified, it is the responsibility of the Gateway-Library programmer to determine what action is taken.

NoteTDSLONGVARCHAR truncation can also be specified at the mainframe during customization. If truncation is set on at either the mainframe or the TRS, truncation occurs.

ROW_LIMIT

This argument is ignored.

REMOTE_TRACE_FLAG

(O) Variable that contains the TRS tracing indicator. This is a Boolean value that indicates whether tracing is on or off at the TRS.

One of the following values is returned in this variable:

TDS_TRUE (1)

TRS tracing is on.

TDS_FALSE (0)

TRS tracing is off.

USER_CORRELATOR

(I) Information argument. You can use this argument for any purpose.

DB2GW_OPTIONS

This argument is ignored.

DB2GW_PID

This argument is ignored.

REQUEST_TYPE

(O) Type of request to be accepted. Returns one of the following values:

TDS_LANGUAGE_EVENT (1)

Current request is a language request.

TDS_RPC_EVENT (3)

Current request is an RPC.

TDS_DYNAMIC_EVENT (4)

Current request is a dynamic SQL request.

TDS_CURSOR_EVENT (5)

Current request is a cursor request.

TDGETREQ and TDINFRPC also return this information.

NoteThese are new values. The old values of TDS_START_SQL and TDS_START_RPC still work, but you should use the new values from now on.

Returns

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

Table 3-16: TDINFPGM 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_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 the use of TDINFPGM to determine what kind of request was received. This example is taken from the sample program in Appendix C, “Sample Language Application for CICS.”

 	 /*      Accept client request                                       */
  	 /*      ------------------------------------------------------------*/
          CALL TDACCEPT (GWL_PROC, GWL_RC, GWL_INIT_HANDLE,
                         SNA_CONNECTION_NAME,
                         SNA_SUBC);
 
  	 /*      ------------------------------------------------------------*/
  	 /*      ensure kicked off via language request                      */
  	 /*      (this could be handled more reasonably by TDRESULT)         */
  	 /*      ------------------------------------------------------------*/
          CALL TDINFPGM (GWL_PROC, GWL_RC,
                         GWL_INFPGM_TDS_VERSION,
                         GWL_INFPGM_LONGVAR,
                         GWL_INFPGM_ROW_LIMIT,
                         GWL_INFPGM_REMOTE_TRACE,
                         GWL_INFPGM_CORRELATOR,
                         GWL_INFPGM_DB2GW_OPTION,
                         GWL_INFPGM_DB2GW_PID,
                         GWL_INFPGM_TYPE_RPC);
 
          IF GWL_INFPGM_TYPE_RPC ^= TDS_START_SQL THEN
          DO;
              MSG_TEXT   = MSG_NOT_LANG;
              MSG_TEXT_L = STG(MSG_NOT_LANG);
              CALL SEND_ERROR_MESSAGE;
              GO TO END_PROGRAM;
          END;

Usage


TDINFPGM

A server application uses this function to get information about the client request (remote program). This function can be used only by a server.

See also

Related documents