Consultor Eletrônico



Kbase P75991: How to run a 4GL procedure in the background using windows to do some database processing periodical
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   23/06/2006
Status: Verified

GOAL:

How to run a 4GL procedure in the background using windows to do some database processing periodically?

FIX:

To run a procedure in the background, use the -b (batch) client startup procedure.

In the following solution, a 4GL procedure executes a loop every 5 seconds till the customer balance is negative. Here is a step by step procedure on how to develop and deploy such a solution:

1. Create a windows shortcut to run the procedure as a batch WINDOWS client process with a command line similar to:

C:\WINDOWS\system32\cmd.exe /C START /MIN C:\PROGRESS91D\bin\prowin32.exe sports -H localhost -N tcp -S 9999 -b -p checkit.p

or create a windows shortcut to run the procedure as a batch DOS client process with a command line similar to:

C:\WINDOWS\system32\cmd.exe /C START /MIN C:\PROGRESS91D\bin\_progres.exe sports -H localhost -N tcp -S 9999 -b -p checkit.p


2. The following sample.p procedure runs in the background and conditionally executes some logic periodically (every 5 seconds):

DEFINE VARIABLE lContinue AS LOGICAL NO-UNDO INITIAL YES.

OUTPUT TO myfile.txt.
DO WHILE lContinue:
FIND customer WHERE Cust-Num = 1.
lContinue = (Balance > 0).
PUT UNFORMATTED STRING(TIME,"HH:MM:SS") "~t" cust-num "~t" NAME "~t" balance
SKIP.
balance = balance - 1.
PAUSE 5.
END.
OUTPUT CLOSE.
QUIT.

3. Execute the procedure in the background (batch mode) by double clicking on the windows short cut created in step 1 above.

Following are the first few lines of the sample output log file:

13:44:45 1 Lift Line Skiing 100
13:44:50 1 Lift Line Skiing 99
13:44:55 1 Lift Line Skiing 98
...