467,185 Members | 1,242 Online
Bytes | Developer Community
Ask Question

Home New Posts Topics Members FAQ

Post your question to a community of 467,185 developers. It's quick & easy.

Shell Script eroor while using db2 export


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
  • viewed: 2347
Share:
3 Replies
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
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

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.

Similar topics

2 posts views Thread by Jorgen Grahn | last post: by
reply views Thread by paulhjwu@gmail.com | last post: by
6 posts views Thread by vito | last post: by
reply views Thread by chettiar | last post: by
2 posts views Thread by scott.hafeman@rogers.com | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.