Previous Topic: Request Identifier (IDENTIFIED BY:)Next Topic: CHECK ASYNC RESPONSE


Conditional Clauses (WHEN)

The optional set of WHEN clauses on the GET ASYNC RESPONSE statement, give you processing control that is not available with a synchronous cooperative flow. For example, you may not want to interrupt the application's current processing if an error is detected during the handling of an asynchronous request. Compare this with the processing of a synchronous cooperative flow, where errors are handled by the runtime servicing the flow, and the processing of the initiating PStep is aborted if the runtime detects an error in either the handling of the request or in the actual processing of the target PStep code (that is, an XFAL).

As an application developer, you may want control of the various processing conditions that may occur when servicing an asynchronous flow. Alternatively, you may prefer that the runtime process errors in the same way as they are handled for existing synchronous flows. The behavior of the GET ASYNC RESPONSE statement can be modified, depending on which of the WHEN clauses you include in the statement.

When executing the GET ASYNC RESPONSE statement, the process flow gives control to an applicable WHEN clause, if it is present. When the block of code associated with the WHEN clause has completed, processing continues with the statement immediately after the GET ASYNC RESPONSE statement. All of the WHEN clauses are included in the code when the GET ASYNC RESPONSE statement is constructed by the PAD editor. You can delete any of the WHEN clauses, as required.

Control is passed to the associated WHEN clause under the following circumstances: