Skip to main content

[Migrated content. Thread originally posted on 19 October 2004]

I have a sequence of cobol programs that should be run sequentially ( PROG1 PROG2 & PROG3 ). So I put into a .bat file

wrun32.exe PROG1
wrun32.exe PROG2
wrun32.exe PROG3

But they all run 'simultaneously'. Is there any way to make execution of the .bat file wait until the programs issue their STOP RUNs before continuing?


Secondly, if I issue a STOP RUN with a return code value, how can I test that value in the .bat file? Or do I need a workround ?

Sorry if my problem seems duller than most, but Im still stuck on the basics.

[Migrated content. Thread originally posted on 19 October 2004]

I have a sequence of cobol programs that should be run sequentially ( PROG1 PROG2 & PROG3 ). So I put into a .bat file

wrun32.exe PROG1
wrun32.exe PROG2
wrun32.exe PROG3

But they all run 'simultaneously'. Is there any way to make execution of the .bat file wait until the programs issue their STOP RUNs before continuing?


Secondly, if I issue a STOP RUN with a return code value, how can I test that value in the .bat file? Or do I need a workround ?

Sorry if my problem seems duller than most, but Im still stuck on the basics.
I have not tried either of these things, so keep that in mind...

1) Try prefixing your command with "start /wait":

start /wait wrun32.exe progname
start /wait wrun32.exe progname

2) Try using crun32.exe instead of wrun32.exe. crun32.exe is the Win32 console version of the runtime. Most likely the reason why the batch file is not waiting for the commands to complete is that wrun32 is the graphical version of the runtime.

[Migrated content. Thread originally posted on 19 October 2004]

I have a sequence of cobol programs that should be run sequentially ( PROG1 PROG2 & PROG3 ). So I put into a .bat file

wrun32.exe PROG1
wrun32.exe PROG2
wrun32.exe PROG3

But they all run 'simultaneously'. Is there any way to make execution of the .bat file wait until the programs issue their STOP RUNs before continuing?


Secondly, if I issue a STOP RUN with a return code value, how can I test that value in the .bat file? Or do I need a workround ?

Sorry if my problem seems duller than most, but Im still stuck on the basics.
Magic ! The "start /wait" did the trick. As for "crun32.exe", I don't have that anyway but I don't think I want that because the Cobol application uses GUI type interfaces. So I'm happy with that part of the answer.
Thank you JoeD.

Now for the returned STOP RUN code part ?

[Migrated content. Thread originally posted on 19 October 2004]

I have a sequence of cobol programs that should be run sequentially ( PROG1 PROG2 & PROG3 ). So I put into a .bat file

wrun32.exe PROG1
wrun32.exe PROG2
wrun32.exe PROG3

But they all run 'simultaneously'. Is there any way to make execution of the .bat file wait until the programs issue their STOP RUNs before continuing?


Secondly, if I issue a STOP RUN with a return code value, how can I test that value in the .bat file? Or do I need a workround ?

Sorry if my problem seems duller than most, but Im still stuck on the basics.
Magic ! The "start /wait" did the trick. As for "crun32.exe", I don't have that anyway but I don't think I want that because the Cobol application uses GUI type interfaces. So I'm happy with that part of the answer.
Thank you JoeD.

Now for the returned STOP RUN code part ?

[Migrated content. Thread originally posted on 19 October 2004]

I have a sequence of cobol programs that should be run sequentially ( PROG1 PROG2 & PROG3 ). So I put into a .bat file

wrun32.exe PROG1
wrun32.exe PROG2
wrun32.exe PROG3

But they all run 'simultaneously'. Is there any way to make execution of the .bat file wait until the programs issue their STOP RUNs before continuing?


Secondly, if I issue a STOP RUN with a return code value, how can I test that value in the .bat file? Or do I need a workround ?

Sorry if my problem seems duller than most, but Im still stuck on the basics.
The way you check for a return code in a batch file is to use the %ERRORLEVEL% variable.

I do not know if having to use "start /wait" will interfere with that.

[Migrated content. Thread originally posted on 19 October 2004]

I have a sequence of cobol programs that should be run sequentially ( PROG1 PROG2 & PROG3 ). So I put into a .bat file

wrun32.exe PROG1
wrun32.exe PROG2
wrun32.exe PROG3

But they all run 'simultaneously'. Is there any way to make execution of the .bat file wait until the programs issue their STOP RUNs before continuing?


Secondly, if I issue a STOP RUN with a return code value, how can I test that value in the .bat file? Or do I need a workround ?

Sorry if my problem seems duller than most, but Im still stuck on the basics.
Yep. Perfect. The check on errorlevel works just fine - no problem with the wait.

Thank you for the help.