Unix Technical Forum

Shell Script eroor while using db2 export

This is a discussion on Shell Script eroor while using db2 export within the DB2 forums, part of the Database Server Software category; --> Hi I have a function as below... function PerformQuery3 { $VAR1 = 'export to $1 of ixf messages $2.out ...


Go Back   Unix Technical Forum > Database Server Software > DB2

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 02-27-2008, 07:31 AM
bikkaran@in.ibm.com
 
Posts: n/a
Default 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

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 02-27-2008, 07:31 AM
bikkaran@in.ibm.com
 
Posts: n/a
Default Re: Shell Script eroor while using db2 export

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"

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 02-27-2008, 07:31 AM
Hemant Shah
 
Posts: n/a
Default Re: Shell Script eroor while using db2 export

While stranded on information super highway bikkaran@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: NoJunkMailshah@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.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 02-27-2008, 07:32 AM
Hemant Shah
 
Posts: n/a
Default Re: Shell Script eroor while using db2 export


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 bikkaran@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: NoJunkMailshah@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.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 01:32 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
www.UnixAdminTalk.com