Error Executing a Shell Script via Sequencer

A forum for discussing DataStage<sup>®</sup> basics. If you're not sure where your question goes, start here.

Moderators: chulett, rschirm, roy

Post Reply
horserider
Participant
Posts: 71
Joined: Mon Jul 09, 2007 1:12 pm

Error Executing a Shell Script via Sequencer

Post 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?
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Fully path your .run file. That or 'cd' to where it lives first.
-craig

"You can never have too many knives" -- Logan Nine Fingers
shamshad
Premium Member
Premium Member
Posts: 147
Joined: Wed Aug 25, 2004 1:39 pm
Location: Detroit,MI

Post 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;
Post Reply