Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to write BTEQ batch scripts in Unix

Status
Not open for further replies.

mvnrk

Programmer
Jun 14, 2001
15
US
Hi

How can we write Bteq batch scripts in UNIX?. I need to write Unix shell script. To star with : I need to do some file checking on unix file system, then based on file existance, I need to run diff SQL in Teradata Bteq. After that, depending on Results of SQL, I need to code other shell scripting like moving file, within same script.
My script look like:

step1 :- Unix commands...
step2 :- Unix commands...
step3 :- Unix commands...
step4 :- BTeq Login
step5 :- Teradata SQL..
step6 :- BTEQ Logoff
step7 :- Unix Commands..
step8 :- Unix COmmands..

I'm successful upto STep6, after I logoff from Bteq, script is terminating? I have tried .QUIT, .EXIT and .LOGOFF options. But I need continue with script. Any help is appriciated.

Thanks a lot in advance
 
Hi,

here is one of my bteq scripts.

file="/tmp/.logon.$$"
rm -f $file

echo "logon $1/user,password" > $file
cat $2 >> $file
echo ".quit" >> $file

bteq < $file

rm -f $file

 
echo 'unix command'
echo 'unix command'
bteq << EOF
.logon <systemid>/<userid>,<password>;
select current_timestamp;
.logoff;
.quit;
EOF
echo 'unix command 3'
echo 'unix command 4'
echo 'unix command 5'
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top