By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,226 Members | 1,027 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,226 IT Pros & Developers. It's quick & easy.

Shell Script eroor while using db2 export

P: n/a

Hi I have a function as below...

function PerformQuery3
{
$VAR1 = 'export to $1 of ixf messages $2.out "select * from $3"'

echo $VAR1

SQL_CODE=$(db2 -ec +o $1)
if [[ $SQL_CODE != 0 && $SQL_CODE != 100 && $SQL_CODE != 437 ]]
then
#print -u9 " Error: $2 failed with SQLcode $SQL_CODE"
echo "Program abnormally ended - please check logfile $LOGFILE"
exit 1
else
echo " $2 exported succesfully"
fi

}


I am passing the following parameter to it

PerformQuery3 ZPSST_LICDATA.ixf ZPSST_LICDATA pads006.ZPSST_LICDATA
But it fails .....Can some one please help me .....
Its extremely urgent for me...

Bikash

Mar 27 '06 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Probably the mistake is in VAR1 .....I am unable to build the query to
export data ..

export to filename.ixf of ixf "select * from schemaname.tabname"

Mar 27 '06 #2

P: n/a
While stranded on information super highway bi******@in.ibm.com wrote:

Hi I have a function as below...

function PerformQuery3
{
$VAR1 = 'export to $1 of ixf messages $2.out "select * from $3"'

echo $VAR1

SQL_CODE=$(db2 -ec +o $1) ^^
Shouldn't this be $VAR1

if [[ $SQL_CODE != 0 && $SQL_CODE != 100 && $SQL_CODE != 437 ]]
then
#print -u9 " Error: $2 failed with SQLcode $SQL_CODE"
echo "Program abnormally ended - please check logfile $LOGFILE"
exit 1
else
echo " $2 exported succesfully"
fi

}


I am passing the following parameter to it

PerformQuery3 ZPSST_LICDATA.ixf ZPSST_LICDATA pads006.ZPSST_LICDATA
But it fails .....Can some one please help me .....
Its extremely urgent for me...

Bikash


--
Hemant Shah /"\ ASCII ribbon campaign
E-mail: No************@xnet.com \ / ---------------------
X against HTML mail
TO REPLY, REMOVE NoJunkMail / \ and postings
FROM MY E-MAIL ADDRESS.
-----------------[DO NOT SEND UNSOLICITED BULK E-MAIL]------------------
I haven't lost my mind, Above opinions are mine only.
it's backed up on tape somewhere. Others can have their own.
Mar 27 '06 #3

P: n/a

Looks like it is a shell script, but you are using Perl syntax for variable
assignment, try following:

VAR1="export to $1 of ixf messages $2.out \"select * from $3\""

echo $VAR1

SQL_CODE=$(db2 -ec +o $VAR1)
While stranded on information super highway bi******@in.ibm.com wrote:

Hi I have a function as below...

function PerformQuery3
{
$VAR1 = 'export to $1 of ixf messages $2.out "select * from $3"'

echo $VAR1

SQL_CODE=$(db2 -ec +o $1)
if [[ $SQL_CODE != 0 && $SQL_CODE != 100 && $SQL_CODE != 437 ]]
then
#print -u9 " Error: $2 failed with SQLcode $SQL_CODE"
echo "Program abnormally ended - please check logfile $LOGFILE"
exit 1
else
echo " $2 exported succesfully"
fi

}


I am passing the following parameter to it

PerformQuery3 ZPSST_LICDATA.ixf ZPSST_LICDATA pads006.ZPSST_LICDATA
But it fails .....Can some one please help me .....
Its extremely urgent for me...

Bikash


--
Hemant Shah /"\ ASCII ribbon campaign
E-mail: No************@xnet.com \ / ---------------------
X against HTML mail
TO REPLY, REMOVE NoJunkMail / \ and postings
FROM MY E-MAIL ADDRESS.
-----------------[DO NOT SEND UNSOLICITED BULK E-MAIL]------------------
I haven't lost my mind, Above opinions are mine only.
it's backed up on tape somewhere. Others can have their own.
Mar 28 '06 #4

This discussion thread is closed

Replies have been disabled for this discussion.