Page 1 of 1

Error Executing a Shell Script via Sequencer

Posted: Wed Nov 14, 2007 8:37 am
by horserider
REQUIREMENT

I am trying to have a common shell script that executes any BTEQ script (Teradata SQLs).

Below is my generic shell script
----------------------------------------
SERV=$1
USER=$2
PASS=$3
DBN=$4
BTEQ_FILE=$5
bteq << EOF
.logon $SERV/$USER,$PASS
database $DBN;
.SET ERRORLEVEL 3807 SEVERITY 0;

/* ####### INCLUDE THE BTEQ FILE THAT YOU WANT TO RUN ######### */

. run file = $BTEQ_FILE

/* ####### INCLUDE BTEQ FILE ENDS HERE ########## */

.LOGOFF;
.QUIT;
EOF
---------------------------------------------------------------------------

CALLING SHELL SCRIPT

Then in my sequencer, I am passing all the parameters including the BTEQ script name as below (through routine stage)

$SCRIPT_DIR:"/execute_BTEQ.sh " : tdservname : " " : tduser : " " : tdpass: " " : tddbname : " " : bteqfilename

PROBLEM

I am getting an error in log file as below

. run file = DWL001LD.txt;
*** Error: Open failed because: No such file or directory


QUESTION
Now, when I run the exact same command from my Linux Server I don't get any error. So why is sequencer not working or do I need to pass the parameters in a different way?

Posted: Wed Nov 14, 2007 8:44 am
by chulett
Fully path your .run file. That or 'cd' to where it lives first.

Posted: Wed Nov 14, 2007 9:31 am
by shamshad
Repeating on the above reply, just pass the path of where your .TXT file resides and use it like below in your shell script.

SERV=$1
USER=$2
PASS=$3
DBN=$4
BTEQ_DIR=$5
BTEQ_FILE=$6

bteq << EOF
.logon $SERV/$USER,$PASS
database $DBN;
.SET ERRORLEVEL 3807 SEVERITY 0;
. run file = $5/$6
.LOGOFF;
.QUIT;