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?
Error Executing a Shell Script via Sequencer
Moderators: chulett, rschirm, roy
-
- Participant
- Posts: 71
- Joined: Mon Jul 09, 2007 1:12 pm
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;
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;