Try OpenEdge Now
skip to main content
Developing AppServer Applications
Programming ABL Client Applications : Managing asynchronous requests : Running asynchronous requests on the SESSION system handle
 

Running asynchronous requests on the SESSION system handle

You can execute a RUN...ASYNCHRONOUS statement using a server object handle or a SESSION system handle. If you use a SESSION handle, the request is executed synchronously on the client as if it was called using a synchronous RUN statement. However, unlike a standard synchronous procedure call that returns the results directly to the RUN statement, the results are returned by the event procedure specified on the RUN...ASYNCHRONOUS statement as though it were responding to a PROCEDURE-COMPLETE event from an AppServer.
Thus, using the SESSION handle, the event procedure runs synchronously as part of the RUN statement and returns execution to the statement immediately following the same RUN statement. This is different from using a server handle, where the event procedure runs only in the context of a blocking I/O or PROCESS EVENTS statement that processes the PROCEDURE-COMPLETE event. However, this still allows you to use the RUN...ASYNCHRONOUS statement to program local and remote requests in a similar way, for example, when an AppServer is not available.
Note: In addition to order of execution, using the SESSION handle to run an asynchronous request as a local synchronous request results in error handling that is slightly different from using a server handle. For this reason, you might want to develop using a local AppServer when a network AppServer is not available. For more information on running a local AppServer, see OpenEdge Application Server: Administration. For more information on error handling when using the SESSION handle, see the RUN statement entry in OpenEdge Development: ABL Reference.