Determines whether a request is pending and identify the type of object received.
%INCLUDE SYGWPLI;
01 TDPROC PTR, 01 RETCODE FIXED BIN(31);
CALL TDRESULT (TDPROC, RETCODE);
(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 result of function execution is returned. Its value is one of the codes listed in Table 3-27.
The RETCODE argument can contain any of the return values listed in Table 3-27.
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_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_PARM_PRESENT (203) |
Parameter value received. A parameter was received from the remote client. This value is returned to TDRESULT when a parameter is accepted by a server program and is ready to be retrieved. |
TDS_RESULTS_COMPLETE (500) |
TDRESULT indicated no more results. No, or no more, language text, RPC parameters, cancel requests, or messages were retrieved. |
TDS_SQL_CMD_PRESENT (201) |
Language string received. A language request was received from a remote client. This value is returned to TDRESULT when a language string is accepted by a server program and is ready for retrieval. |
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. |
In the following code fragment, the program calls TDRESULT to ascertain that the incoming request is an RPC, before it retrieves any parameters. This example is taken from the sample program in Appendix B, “Sample RPC Application for CICS.”
/* ------------------------------------------------------------*/ /* accept client request */ /* ------------------------------------------------------------*/ CALL TDACCEPT (GWL_PROC, GWL_RC, GWL_INIT_HANDLE, SNA_CONNECTION_NAME, SNA_SUBC); /* ------------------------------------------------------------*/ /* TDRESULT to validate kicked off via rpc request */ /* ------------------------------------------------------------*/ CALL TDRESULT (GWL_PROC, GWL_RC); IF GWL_RC ^= TDS_PARM_PRESENT THEN DO; CALL TDRESULT_ERROR; GO TO END_PROGRAM; END;
A server application can use this function to determine whether a remote client sent a new request over this connection, and, if so, what kind of request—a language request or an RPC.
If the request is a language request, TDRESULT returns TDS_SQL_CMD_PRESENT.
If the request is an RPC with parameters, TDRESULT returns TDS_PARM_PRESENT.
In a long-running transaction, TDGETREQ returns the type of request pending. There is no need to call TDRESULT after TDGETREQ.
An application can call TDRESULT to determine whether any more results are pending. After all SQL statements or RPC parameters are read in, TDRESULT returns TDS_RESULTS_COMPLETE.
This function is not required. It is included for compatibility with earlier versions of Gateway-Library.
Use TDINFPGM, TDGETREQ, or TDINFRPC to determine what type of request the remote client sent.
Related functions
Copyright © 2005. Sybase Inc. All rights reserved. |
![]() |