Determines whether a request is pending and identifies the type of object received.
COPY SYGWCOB.
01 TDPROC PIC S9(9) USAGE COMP SYNC. 01 RETCODE PIC S9(9) USAGE COMP SYNC.
CALL 'TDRESULT' USING 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. |
The following code fragment illustrates the use of TDINIT, TDACCEPT, TDSNDDON, and TDFREE at the beginning and end of a Gateway-Library program. This example is taken from the sample program, SYCCSAR2, in Appendix B, “Sample RPC Application for CICS.”
* Establish gateway environment CALL 'TDINIT' USING DFHEIBLK, GWL-RC, GWL-INIT-HANDLE. * Accept client request CALL 'TDACCEPT' USING GWL-PROC, GWL-RC, GWL-INIT-HANDLE, SNA-CONNECTION-NAME, SNA-SUBC. * TDRESULT to make sure we were started via RPC request CALL 'TDRESULT' USING GWL-PROC, GWL-RC. IF GWL-RC NOT = TDS-PARM-PRESENT THEN PERFORM TDRESULT-ERROR GO TO END-PROGRAM END-IF.
* ------------------------------------------------------------- * body of program * ------------------------------------------------------------- *-----------------------------------------------------------------
END-PROGRAM.
*-----------------------------------------------------------------
IF SEND-DONE-OK MOVE TDS-DONE-COUNT TO WRK-DONE-STATUS ELSE MOVE TDS-DONE-ERROR TO WRK-DONE-STATUS MOVE ZERO TO PARM-RETURN-ROWS END-IF. CALL 'TDSNDDON' USING GWL-PROC, GWL-RC, WRK-DONE-STATUS, PARM-RETURN-ROWS, TDS-ZERO, TDS-ENDRPC. CALL 'TDFREE' USING GWL-PROC, GWL-RC. EXEC CICS RETURN END-EXEC.
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. |
![]() |