Previous Topic: Request Identifier (IDENTIFIED BY:)Next Topic: Response Handling


Conditional Clauses (WHEN)

The optional set of WHEN clauses on the USE ASYNC statement give the application developer control that is not available with a synchronous cooperative flow. Each of the WHEN clauses is included in the code when a USE ASYNC statement is constructed by the PAD editor. You can delete either or both of the WHEN clauses.

WHEN request accepted—The code contained in this WHEN clause is given control if the supporting runtime reaches a point in its processing where the request is considered accepted. Typically, this is the point where the runtime has sent the request to the target server using the send mechanism of the supporting Middleware. For example, if MQSeries is the transport, all the processing leading up to and including the MPUT of the request must be successful for this WHEN clause to be given control.

If this clause is not present, processing continues with the first statement following the USE ASYNC.

WHEN request not accepted—The code contained in this WHEN clause is given control if the supporting runtime encounters an error attempting to initiate the asynchronous cooperative flow. The ERROR_MESSAGE field, of the specified ASYNC_REQUEST view, contains a message explaining why the given request was not accepted for processing.

If deleted, the runtime terminates the initiating PStep. This process is similar to an error occurring during a failed USE Procedure Step statement. The currently executing code block is exited.

Note: A request must be successfully accepted before it can be referenced by other statements that are subsequently used to check or retrieve the response (GET ASYNC RESPONSE, CHECK ASYNC RESPONSE and IGNORE ASYNC RESPONSE).