Previous Topic: Response HandlingNext Topic: Examples


Response Scope

By default, the scope of an asynchronous request is limited to the initiating PStep. All outstanding requests initiated by a PStep are implicitly ignored when the PStep exits. When operating in a GUI application, there may be cases, you may wish to retain the response so that it can be obtained by a different PStep executing within the same process. The scope of the response is indicated via the RESPONSE SCOPE clause specified on the USE ASYNC statement. RESPONSE SCOPE may be either PSTEP or GLOBAL, where PSTEP limits the scope to the initiating PStep, and GLOBAL indicates that the response is considered global to all Procedure Steps executing in the process.

If you write one application PStep to initiate an asynchronous cooperative flow, and another PStep to complete the flow, you must preserve the content of the ASYNC_REQUEST view instance that you used to initiate the outstanding request. This is necessary so that the processing that completes the flow can specify the identifier in either the GET ASYNC RESPONSE statement or the IGNORE ASYNC RESPONSE statement.

Contrary to the cleanup provided for the default scope of PSTEP (that is, where the request is considered complete), the runtime does not implicitly complete an outstanding request where the response scope is marked as GLOBAL. You must include application logic that is responsible for completing requests that indicate their associated response have a GLOBAL scope. That is, the application logic must issue either a GET ASYNC RESPONSE or an IGNORE ASYNC RESPONSE to complete the request.

Note: The CA Gen Server Runtime only supports a RESPONSE SCOPE of PSTEP. That is, a response to an outstanding request cannot linger across invocations of a target server PStep. All asynchronous cooperative flows initiated by a server PStep (that is, server-to-server flows) must be completed explicitly by the server PStep code, or implicitly by the Server Runtime, prior to returning control to the invoking client application component.