TDINFPRM

Description

Retrieves parameter type, datatype, and length information about a specified RPC parameter.

Syntax

%INCLUDE SYGWPLI;
01 TDPROC             PTR,
01 RETCODE            FIXED BIN(31),
01 PARM_ID            FIXED BIN(31),
01 DATATYPE           FIXED BIN(31),
01 ACTUAL_DATA_LENGTH FIXED BIN(31),
01 MAX_DATA_LENGT     FIXED BIN(31),
01 PARM_STATU         FIXED BIN(31),
01 PARM_NAME          CHAR(30),
01 PARM_NAME_LENGTH   FIXED BIN(31),
01 USER_DATATYP       FIXED BIN(31);
CALL TDINFPRM   (TDPROC, RETCODE, PARM_ID, DATATYPE,
	ACTUAL_DATA_LENGTH, MAX_DATA_LENGTH,
	PARM_STATUS, PARM_NAME,
                PARM_NAME_LENGTH, USER_DATATYPE); 

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

PARM_ID

(I) Number of the parameter with the information that is requested. Parameters are numbered sequentially; the first parameter is number 1.

DATATYPE

(O) Variable where the Open Client datatype of the parameter is returned. The datatype is specified by the client.

ACTUAL_DATA_LENGTH

(O) Variable where the actual length of the parameter data is returned. For TDSVARYCHAR, TDSVARYBIN, and TDSVARYGRAPHIC parameters, this value does not include the 2 bytes for the “LL” length specification.

MAX_DATA_LENGTH

(O) Variable where the maximum length allowed for the parameter’s data is returned. This value is specified by the client in the parameter definition. For TDSVARYCHAR, TDSVARYBIN, and TDSVARYGRAPHIC parameters, this value does not include the 2 bytes for the “LL” length specification.

PARM_STATUS

(O) Variable where the parameter’s status is returned. This argument indicates whether or not the named parameter is a return parameter. It returns one of the following values, depending on the TDS version you are using:

TDS 4.6:

TDS_INPUT_VALUE (0)

Parameter is not a return parameter.

TDS_RETURN_VALUE (1)

Parameter is a return parameter.

TDS 5.0:

TDS_INPUT_VALUE_NULLABLE (32)

Parameter is a nullable non-return parameter.

TDS_RETURN_VALUE_NULLABLE (33)

Parameter is a nullable return parameter.

The client specifies the value of this argument.

PARM_NAME

(O) Variable where the name of the incoming parameter is stored. This is the name given to the parameter by the client.

PARM_NAME_LENGTH

(O) Variable where the length of the parameter name is returned. The name length is specified by the client when the RPC is sent.

USER_DATATYPE

(O) Variable where the user-assigned datatype for this parameter is stored. This argument is used for return parameters only.

Returns

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

Table 3-18: TDINFPRM return values

Return value

Meaning

TDS_OK (0)

Function completed successfully.

TDS_CANCEL_RECEIVED (-12)

Operation canceled. The remote partner issued a cancel. The current operation failed.

TDS_CONNECTION_FAILED (-4998)

Connection abended. The client/server connection abnormally ended (for example, the LU 6.2 session crashed or the remote transaction abended).

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.

TDS_NO_PARM_PRESENT (103)

No incoming parameters present. TDRCVPRM cannot retrieve a parameter because no more parameters were accepted. The operation failed.

TDS_WRONG_STATE (-6)

This function cannot be used in the current communication state. For example, your program tried to send a reply before it read in all of the client parameters. The application was still in RECEIVE state and could not send. The operation failed.

Examples

Example 1

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

 	 /*------------------------------------------------------------------*/
	GET_PARMS:
  	 /*------------------------------------------------------------------*/
 
  	 /*      ------------------------------------------------------------*/
  	 /*      get return parameter information                            */
  	 /*      ------------------------------------------------------------*/
          GWL_INFPRM_ID = 1;
          CALL GET_PARM_INFO;
 
          (IF GWL_INFPRM_STATUS ^= TDS_RETURN_VALUE AND
          IF GWL_INFPRM_STATUS ^= TDS_RETURN_VALUE_NULLABLE) THEN
          DO;
 
              CALL TDINFPRM_NOT_RETURN_PARM_ERROR;
              GO TO END_PROGRAM;
          END;
 
          GWL_SETPRM_USER_DATA = GWL_INFPRM_USER_DATA;
          GWL_SETPRM_ID        = GWL_INFPRM_ID;
          GWL_SETPRM_DATA_L    = GWL_INFPRM_DATA_L;
          GWL_SETPRM_TYPE      = GWL_INFPRM_TYPE;
 
  	 /*      ------------------------------------------------------------*/
  	 /*      get department id parameter number from known name          */
  	 /*      ------------------------------------------------------------*/
          GWL_INFPRM_NAME   = '@parm2';
          GWL_INFPRM_NAME_L = 6;
 
          CALL TDLOCPRM (GWL_PROC,
                         GWL_INFPRM_ID,
                         GWL_INFPRM_NAME,
                         GWL_INFPRM_NAME_L);
 
  	 /*      ------------------------------------------------------------*/
  	 /*      get department parameter information                        */
  	 /*      ------------------------------------------------------------*/
          CALL GET_PARM_INFO;
 
          IF GWL_INFPRM_TYPE ^= TDSVARYCHAR THEN
          DO;
              CALL TDINFPRM_NOT_CHAR_PARM_ERROR;
              GO TO END_PROGRAM;
          END;
 
  	 /*      ------------------------------------------------------------*/
  	 /*      get department parameter data                               */
  	 /*      ------------------------------------------------------------*/
          CALL TDRCVPRM (GWL_PROC, GWL_RC,
                         GWL_INFPRM_ID,
                         PARM_DEPT,
                         GWL_INFPRM_TYPE,
                         GWL_INFPRM_MAX_DATA_L,
                         GWL_RCVPRM_DATA_L);
  	 /*------------------------------------------------------------------*/
	GET_PARM_INFO: PROC;
  	 /*------------------------------------------------------------------*/
          CALL TDINFPRM (GWL_PROC, GWL_RC,
                         GWL_INFPRM_ID,
                         GWL_INFPRM_TYPE,
                         GWL_INFPRM_DATA_L,
                         GWL_INFPRM_MAX_DATA_L,
                         GWL_INFPRM_STATUS,
                         GWL_INFPRM_NAME,
                         GWL_INFPRM_NAME_L,
                         GWL_INFPRM_USER_DATA);
 
 
          RETURN;
 
  END GET_PARM_INFO;

Usage


TDINFRPC

A server application uses this function to retrieve type and length information about a parameter before it retrieves it. This can be any supported type of parameter including cursor parameters.

See also

Related functions