Can I invoke internal procedute asynchronously (without AppServer)?
for example I run procedure "test1.p":
test1.p:
---------------------------------------------------
def var procHand as handle.
run test2.p persistent set procHand.
for each Customer no-lock:
if Customer.Balance > 1100 and Customer.Balance < 1200 then
do:
run doSomething in procHand asynchronous (input Customer.CustNum).
display Customer.CustNum.
display Customer.Name.
display Customer.Phone.
end.
...
end.
---------------------------------------------------
test2.p:
---------------------------------------------------
def var xTxt as char no-undo init ''.
xTxt = 'QWERTY'.
PROCEDURE doSomething:
def input param pCustNum as integer.
output to test.txt.
find first Customer where Customer.CustNum = pCustNum no-lock no-wait no-error.
if avail Customer then
do:
export CustNum Name Country State City Phone.
end.
output close.
message 'Finish of asynchronous procedure' view-as alert-box info buttons OK.
END PROCEDURE.
---------------------------------------------------
This run properly, but unfortunatelly - synchronously.
Order of execution is:
1. run doSomething in procHand asynchronous (input Customer.CustNum).
2. All commands form procedure "doSomething"
3. display Customer.CustNum.
4. display Customer.Name.
5. display Customer.Phone.
I need to run this asynchronously so that the order of execution is:
1. run doSomething in procHand asynchronous (input Customer.CustNum).
2. display Customer.CustNum.
3. display Customer.Name.
4. display Customer.Phone.
and procedure "doSomething" was performed as a separate thread.
Is it possible?
The short answer is 'no'. But you can - if you want to - initate a second session that communicates via sockets or database table to do extra work. That would not work well for the example you give here I guess, since you probably want to invoke several async processes.
The short answer is 'no'. But you can - if you want to - initate a second session that communicates via sockets or database table to do extra work. That would not work well for the example you give here I guess, since you probably want to invoke several async processes.