Problem:
Trying to execute batch file with CBL_EXEC_RUN_UNIT and receiving error code :173, pc=0, call=1, seq=0 called program not found in drive/directory.
Resolution:
CBL_EXEC_RUN_UNIT creates a synchronous or asynchronous run-unit for the execution of COBOL programs. It does not start a command processor and therefore cannot "run" a batch file. However, a command processor can be started to run a batch file from a CBL_EXEC_RUN_UNIT command line. Use a command line such as below to start a command processor and execute a batch file (the "/C" switch is a "continuation" switch to get the command processor to read the remainder of the command line):
cmd /C t.bat
CBL_EXEC_RUN_UNIT cannot start Notepad.exe (for example) because Notepad is not a COBOL program. The same work around as above can be used to overcome this limitation. Start a command processor and execute a batch file that executes Notepad.exe.
X'91' function 35 (which does start a command processor) or the Win32 CreateProcess API (which also starts a command processor) are alternatives that will execute batch files as well as programs.
See Related (tab) above for a CreateProcess example.
