I want to use Asynchronous method but the problem is when I write a query like below then program read only main block and definition section and it's not entered into procedure section. I want to read that too.
DEFINE VARIABLE hAsynCall AS HANDLE NO-UNDO.
ASSIGN cPgmTest = Test.p
RUN VALUE(cPgmTest) ON SERVER gshAstraAppserver ASYNCHRONOUS
SET hAsynCall (INPUT 'Csv') NO-ERROR.
IF ERROR-STATUS:ERROR THEN DO:
MESSAGE ERROR-STATUS:GET-MESSAGE(1).
END.
DO WHILE NOT hAsynCall :COMPLETE:
PROCESS EVENTS.
IF hAsynCall :COMPLETE THEN
MESSAGE "completed"
VIEW-AS ALERT-BOX INFORMATION.
ELSE /* Async result not ready, so do something else. */
MESSAGE "Not yet ..." VIEW-AS ALERT-BOX INFORMATION.
END.
/* Test.p*/
/* Definition*/
/*Main Block*/
DEFINE INPUT PARAMETER cData AS CHARACTER NO-UNDO.
PAUSE 5.
/*Procedure*/
/*Function*/
As you see above the program was read up to main block but if i cut the query from main block and paste into procedure block then its doesn't not entered.
You need to run your AppServer procedure persistently and then run the asynchronous call in that.
Something like:
DEFINE VARIABLE hp AS HANDLE NO-UNDO.
RUN test.p PERSISTENT SET hp.
RUN whatever IN hp ASYNCRHONOUS SET hasync ( "csv" ).
FINALLY:
DELETE OBJECT hp.
END FINALLY.
Note that this pattern incurs two additional AppServer calls, a proxy stub can be used to prevent this.
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments