Problem while execution of second set of commands

Hi,
I have a shell script with code
. perf.env
cd $QRY_DIR
for SHELL_FILE in sql1
do
export SNAME=$SHELL_FILE
${SCRIPT_DIR}/perf_qry.sh ${SPOOL_DIR} ${DB_ENVNAME} ${NAME} &
RC=$(expr ${RC:-0} + $? )
sleep 60
if [ $RC == 0 ]
then
echo sysdate>test1
echo query1.txt>>test1
grep -i selected sql_test.txt>>test1
grep -i elapsed sql_test.txt>>test1
awk '/rows selected/ { $0=$1 } /Elapsed/ { split($2, t, ":");$0=3600*t[0]+60t[1
]+'t[2]+.001
t[3]' }{ out=out sprintf("%s%s",NR==1?"":",","\047"$0"\047") }END{
print("insert into FDW_QUERY_TIME values ("out");") }' test1>test2
fi
done
exit $RC

My problem is after executing the sql1 and the spooling is completed I want to execute the next bit of code after sleep.I actually want to grep the spooled file items.but before spooling is completed the command are executed.
Can any one help me to correct this

Dont know the reason but my post has been duplicated..So this thread can be closed