Kbase 20784: 4GL. How to Handle 4GL Asynchronous Requests
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  16/10/2008 |
|
Status: Unverified
GOAL:
How to handle a 4GL asynchronous request using WAIT-FOR or EVENT-PROCEDURE statements.
FACT(s) (Environment):
Progress 4GL
Progress 9.1X
FIX:
Beginning with Version 9.1A, Progress has the ability to execute asynchronous requests on the AppServer. Because the main process flow continues after a RUN...ASYNCHRONOUS... statement and the asynchronous request is running on the AppServer at the same time, the way to handle the end of an asynchronous request is different than a synchronous request. A synchronous request locks the client session until the process is finished, but the client session is not locked if an asynchronous process is running. You can tell when the process is finished with the WAIT-FOR or EVENT-PROCEDURE statement.
The following is an example of the RUN?ASYNCHRONOUS statement:
RUN async.p /*process name*/ ASYNCHRONOUS SET hProcess /*process
handle*/
EVENT-PROCEDURE "procedureComplete":U IN THIS-PROCEDURE
ON SERVER hServer /*server handle*/
(INPUT?., OUTPUT?, INPUT-OUTPUT TABLE?).
If the end of the asynchronous request is required before the main process flow continues, the WAIT-FOR statement should be used.
RUN? ASYNCHRONOUS? PESISTENT SET hProcess??.
?
/*The main process flow will be paused until the asynchronous
request is finished*/
WAIT-FOR "PROCEDURE-COMPLETE":U OF hProcess.
The EVENT-PROCEDURE is the procedure that is executed after the asynchronous request is finished. It is defined in the RUN statement using EVENT-PROCEDURE <procedure-name>. This procedure receives the parameters from the asynchronous request.