BTEQ - stopping on error in DOS

Tools & Utilities
Enthusiast

BTEQ - stopping on error in DOS

Hi,

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.

e.g

Part1.bat  contains BTEQ < Process1.sql

Part2.bat  contains BTEQ < Process2.sql

 

These are invoked by an overarching master batch script -

 

Part1.bat

Part2.bat

etc

 

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?

 

thank you

 

2 REPLIES 2
Teradata Employee

Re: BTEQ - stopping on error in DOS

 

 

Hi Lossecanons,

 

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 :

call :work_master

: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
Highlighted
Enthusiast

Re: BTEQ - stopping on error in DOS

Thanks for your help
I will give that a try. I've inherited some scripts and trying to make it more robust.