I hope there is a simple answer to this.
I have a series of individual BTEQ scripts that are invoked by a set of batch files (.bat) in Windows.
Part1.bat contains BTEQ < Process1.sql
Part2.bat contains BTEQ < Process2.sql
These are invoked by an overarching master batch script -
Each BTEQ script has the standard error checks and completes with a zero or non-zero return code.
If an error is encountered in the first script how can I stop the other scripts running? Can I add a check in the master script for a non-zero return code and interrupt the rest of the process?
I think you can try the errorlevel of the command return like this, and go to a forced exit using labels.
Very very basic script :
:work_master call :part1 call :part1 call :work_end goto :eof :part1 cmd part1.bat if "!errorlevel!" neq "0" ( call :work_error ) goto :eof :part2 cmd part2.bat if "!errorlevel!" neq "0" ( call :work_error ) goto :eof :work_error echo Error goto :eof :work_end echo End goto :eof