Returns the ID number of a parameter when the parameter name is received.
%INCLUDE SYGWPLI;
01 TDPROC PTR, 01 PARM_ID FIXED BIN(31), 01 PARM_NAME CHAR(n), 01 PARM_NAME_LENGTH FIXED BIN(31);
CALL TDLOCPRM (TDPROC, PARM_ID, PARM_NAME,
PARM_NAME_LENGTH);
(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.
(O) Variable where the number of the named parameter is returned. Parameters are numbered sequentially; the ID of the first parameter is 1. If a 0 is returned here, TDLOCPRM could not find a parameter with the specified name.
(I) The name associated with the desired parameter. This name corresponds to the parameter name in the Open Client DB-Library dbrpcparam routine.
(I) The actual length of the PARM_NAME.
This function has no RETCODE argument. It returns the parameter ID in the PARM_ID argument, or a 0 if it finds no parameter with the specified name.
The following code fragment illustrates a typical use of TDLOCPRM. 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);
/*------------------------------------------------------------------*/
END_OF_QUERY:
/*------------------------------------------------------------------*/
/* ------------------------------------------------------------*/
/* close cursor */
/* ------------------------------------------------------------*/
EXEC SQL CLOSE ECURSOR;
/* ------------------------------------------------------------*/
/* update return parameter with nr of rows fetched */
/* ------------------------------------------------------------*/
CALL TDSETPRM (GWL_PROC, GWL_RC,
GWL_SETPRM_ID,
GWL_SETPRM_TYPE,
GWL_SETPRM_DATA_L,
PARM_RETURN_ROWS,
GWL_SETPRM_USER_DATA);
GO TO END_PROGRAM;
A server application uses this function to determine the ID of a parameter with a name that is known.
If no parameter matching the specified name is found, this function returns 0 in the PARM_ID argument.
Related functions
Related documents
Open Client DB-Library Reference Manual (dbrpcparam)
| Copyright © 2005. Sybase Inc. All rights reserved. |
|
|