Execute BTEQ script from batch file

Database

Execute BTEQ script from batch file

Hi All,

I have 7 BTEQ scripts which i want to execute using batch file. These script should run in sequence and if any one of them fails, the batch should stop processing and exit.

Currently, even if my first script fails, the batch goes and process the rest of the script. I want it to stop the execution as soon as it encounter a failure.

Any suugestion how i can achieve that?

Thanks,

Atul.

1 REPLY
Teradata Employee

Re: Execute BTEQ script from batch file

You can add something like this at the end of your script:

.IF ERRORCODE<> 0 THEN .GOTO YOUSHOULSTOP

-- ############################################################
-- # CONTINUE WIHT SQL 2 #
-- ############################################################

.RUN FILE FileSQL_2.sql;

.QUIT ERRORCODE

.LABEL YOUSHOULSTOP
.QUIT ERRORCODE

And similar in the second sql file, ....

But I think If your working in linux you'd better catching the errorcode as a system linux variable ($?) and stopping next bteq using a linux if

Regards