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 ...
| |||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| 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 |
| |||
| 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. |
| ||||
| 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. |