Problem in shell script

:confused:
Hi,

I have written a script which calls a stored procrdure. The Stored procedure has 2 inputs and 6 outputs. I need to capture one of the outputs.
But I am not able to get any result from this simple script-

! /bin/ksh
echo "connect to dbau user etlbitst using anf1892;" > /tmp/Nscript3.sql
echo "call CORRTEST.XSD060('${1}', '${2}',?,?,?,?,?,?);" >> /tmp/Nscript3.sql
db2 -tvf /tmp/Nscript3.sql -z /tmp/Nscript3.out > /dev/null
OutPut2=`head -12 /tmp/Nscript3.out | tail -1`
rm -f /tmp/Nscript3.out
RtrnCode=`echo $OutPut2 | cut -c3-19`
echo $RtrnCode

please let me know if there is any mistake.....

Regards
Arnie

Hi Arnie,

Are you able to execute the proc from ur shell script? I guess you wont be able to do so...Seems ur database is DB2...
Ur shell script doesn't have any command to connect to database.....

db2 -tvf /tmp/Nscript3.sql -z /tmp/Nscript3.out > /dev/null

I dont ve any idea about this command but i guess in no way this command going to connect the shell to the database...

The /tmp/Nscript3.sql file contains the procedure call....

I ll tell you another simple approach....
First get connected to the database....
Then just call the procedure and store its output in some variables....This way you ll not to have to use the temp file...

I have been using this process in many of my scripts...Try it out...