To handle the response from an asynchronous request, you must define an event procedure. In this context, an event procedure is an internal procedure that executes in response to a PROCEDURE-COMPLETE event. To define an event procedure you must:
Specify the name of the event procedure using the EVENT-PROCEDURE option on the RUN...ASYNCHRONOUS statement that executes the request.
Define an internal procedure with the same name as the event procedure specified in the RUN...ASYNCHRONOUS statement.
Typical places where you might define the specified internal procedure include:
The same procedure context as the RUN...ASYNCHRONOUS statement that specifies the event procedure.
An external procedure context that you specify using the EVENT-PROCEDURE option on the RUN...ASYNCHRONOUS statement using its procedure handle. In this case, the external procedure context must be active in the client session before you execute the RUN...ASYNCHRONOUS statement.
You must define the specified internal procedure with INPUT parameters that correspond in type and order to the OUTPUT and INPUT-OUTPUT parameters that you specify on the RUN...ASYNCHRONOUS statement.
To receive results from the asynchronous request in an event procedure, you can access:
The asynchronous request handle for the request using the SELF system handle
The attributes and methods of the ERROR-STATUS system handle to obtain error information from the request
Values passed as output parameters from the remote procedure to corresponding input parameters in the event procedure
The RETURN-VALUE function to get the return value from the request