Waiting until batch file is complete to proceed (Arev32)
At 27 AUG 2010 11:17:58AM Mat Kelly wrote:
I am calling a series of batch files:
BFS=BATCHONE,BATCHTWO,BATCH3"
CONVERT "," TO @VM IN BFS
FOR F=1 TO COUNT(BFS,@VM) + 1
BFILE=BFS:".BAT"
PERFORM "SUSPEND EXIT ":BFILE
NEXT X
CALL MSG("BATCH FILE EXECUTION DONE")
CALL MSG is being executed prior to the batch files completing. How would I go about assuring that the message is not called until the batch files have completed?
At 27 AUG 2010 12:55PM [url=http://www.sprezzatura.com]The Sprezzatura Group[/url] wrote:
Write out a semaphore file before the for next loop and after the next loop check for the existence of the file. Make the last line of the last batch file the deletion of the semaphore file.
World leaders in all things RevSoft
At 27 AUG 2010 02:46PM Mat Kelly wrote:
Sprezzatura,
The final batch file may not necessarily be the one that completes last. If batch file 3/3 finishes first and 1/3 and 2/3 are still processing, the Arev32 code will proceed regardless of whether all of the batch files have completed. A solution, I presume, would be to have some sort of semaphore for each batch file, but that doesn't scale well. Is there some reliable way to determine whether all batch files have completed?
At 27 AUG 2010 05:47PM [url=http://www.sprezzatura.com]The Sprezzatura Group[/url] wrote:
OK trying to avoid taking you down arcane windows API routes…
Please note we have never had this requirement and so this is a theoretical exercise for the reader to flesh out.
There is an extension to the DOS copy command which will APPEND to an existing file. So have each batch file copy a 1 byte file onto an existing 1 byte file. When dir(file) - 1=x then exit.
More elegant solutions doubtless exist but….
World leaders in all things RevSoft
At 27 AUG 2010 07:08PM Warren Auyong wrote:
Use the /wait option on the START command. Since START is an internal command of CMD.EXE you have to do something like this:
cmdstring=CMD /C START /W your.bat'
SUSPEND cmdstring
You may have to include the path to your bat file or use the /d switch to specify the path.
At 28 AUG 2010 02:48AM Bryan Shumsky wrote:
Hi, Matt. Which version of OpenInsight are you running your AREV32 on? My simple testing shows that the SUSPEND does correctly wait for the requests to finish before returning to AREV32 (at least on my copy of 9.2).
Of course, I'm assuming that the typos in the program listing you provided don't reflect your actual program - specifically:
BFILE=BFS:".BAT"
should really be
BFILE=BFS:".BAT"
and
NEXT X
should be
NEXT F
But after making those changes, and creating dummy BATCHONE.BAT, BATCHTWO.BAT, and BATCH3.BAT files (all of which did just DIR), it processed these 3 files to completion before putting up the message.