Highlighted
Absent Member.
Absent Member.
1293 views

[archive] wrun32.exe and "DOS"

[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.
0 Likes
4 Replies
Highlighted
Absent Member.
Absent Member.

RE: [archive] wrun32.exe and "DOS"

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.
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] wrun32.exe and "DOS"

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 ?
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] wrun32.exe and "DOS"

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.
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] wrun32.exe and "DOS"

Yep. Perfect. The check on errorlevel works just fine - no problem with the wait.

Thank you for the help.
0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.