Capturing output of procedure in variable in shell script

Hi guys
I am calling one DB2 stored proc through unix. It is giving me below output. I want to capture the value 150 in one UNIX variable in shell script. Please let me know how I can achieve this. Thanks in advance

Value of output parameters
--------------------------
Parameter Name : ROW_CNT
Parameter Value : 150
Return Status = 0

Please show how u r executing DB2 stored procedure in your shell script. Also, do u redirect the output of this procedure to any file?

I am doing like below...

a=call DWH.P_CALC_COUNT('TABLE_NAME',?)

when I am doing echo $a

it is giving below output :

Value of output parameters -------------------------- Parameter Name : ROW_CNT Parameter Value : 100 Return Status = 0

I want to just capture 100 here and store it in some variable.

Kindly let me know if you have any solution.

It would be better if u spool the output of this procedure into a file and then grep the value of parameter from that spooled file. Hope u understand what I have pointed out.

DB Procedure:

spool abc.txt
your procedure content
spool off

Shell script:

call DWH.P_CALC_COUNT('TABLE_NAME',?) 
a=`grep "Parameter Value" abc.txt | sed 'g/ /d' | cut -d":" -f2`

And if u r not allowed to do so, then execute following sed command to extract parameter value.

a=`call DWH.P_CALC_COUNT('TABLE_NAME',?)  | sed 's/Parameter Value : (.*) Return Status/\1/g'`
a=$(call DWH.P_CALC_COUNT('TABLE_NAME',?) |awk '/ Parameter Value/ {print $NF}' )
{ read; read; read; read line; val=${line##* } ;} << EOV
$a
EOV
val=${a##*Value : }
val=${val%%
*}