Try OpenEdge Now
skip to main content
Application Migration and Development Guide
Application Development with PAS for OpenEdge : Programming ABL Client Applications : Managing asynchronous requests : Mixing synchronous and asynchronous requests
 
Mixing synchronous and asynchronous requests
If you attempt to execute a synchronous request on a server connection with outstanding asynchronous requests, The client session raises the ERROR condition. You can determine if there are any outstanding asynchronous requests for a server object by checking the value of the ASYNC-REQUEST-COUNT attribute of the appropriate server handle.
You can also ensure that all asynchronous requests for a given server handle have completed execution by the way you set up your event management in the client. Specify the PROCEDURE-COMPLETE event in the WAIT-FOR statement for the asynchronous request handle that corresponds to the last asynchronous request submitted before the WAIT-FOR statement is executed. For example, assume that you submit three asynchronous requests for some server handle and that the asynchronous request handles are returned in HANDLE variables hdl1, hdl2, and hdl3. To ensure that there are no outstanding asynchronous requests before submitting a synchronous request, execute the WAIT-FOR statement specifying the PROCEDURE-COMPLETE event for hdl3.