coopermarsh
MIS
HI
I get the error test: Unkonwn opertaor 0
from the follwoing script
I get the error test: Unkonwn opertaor 0
from the follwoing script
Code:
#!/bin/sh
###########################################################################
# #
# Script Name: mm_ccy_check #
# #
# #
# Written by: N. Mistry #
# #
# Date: 18dec09 #
# #
# Purpose: Identify all MM IAM and PLD trades of a different currency to #
# that recorded in the Kondor+ Foldername #
# #
###########################################################################
KPLUSHOME3=/usr/kplushome
EFFIXARCH=sun4sol
KPLUSLIST="kplus databases/Install"
SYBASE=/var/opt/sybase
DSQUERY=KONDOR_SUPP
ISQL=$SYBASE/OCS-12_5/bin/isql
export KPLUSHOME3 EFFIXARCH KPLUSLIST SYBASE ISQL DSQUERY
PW=`cat ${KPLUSHOME3}/bin/.KPLUS_PW`
# SCRIPTDIR=/global/kondor-rg/apps/bgb/scripts
SCRIPTDIR=/global/kondor-test-rg/apps/bgb/scripts
TMP_FILE=/tmp/mm_ccy_check.tmp
ADMIN_RECIPIENTS="yyy@list.lbb.de"
RECIPIENTS="yyy@xxx\
yyy@xxx"
#RECIPIENTS="yyy@xxxx"
MESG_FILE=${SCRIPTDIR}/mm_ccy_check.msg
${ISQL} -Ukplus -P${PW} -w1024 -o /tmp/mm_ccy_check.tmp <<-EOF
use Kustom
go
sp_MM_Ccy_Check_test
go
EOF
echo debug1
grep -e "Msg" ${TMP_FILE} > /dev/null 2>&1
if [ $? -eq 0 ] ; then
echo "Database error. \nPlease refer to ${TMP_FILE} file for error message.\nExiting ..." > ${TMP_FILE}
/usr/bin/mailx -r ldn-unix@list.lbb.de -s "ERROR - mm_ccy_check - sp_MM_Ccy_Check_test " ${ADMIN_RECIPIENTS} < ${TMP_FILE}
exit 1
fi
echo debug2
#sed -e "/return status/d" ${TMP_FILE} > ${TMP_FILE}.edit
#mv ${TMP_FILE}.edit ${TMP_FILE}
echo debug3
count=`cat /tmp/mm_ccy_check.tmp | grep row | cut -c2-3`
echo $count
count1=`echo $count|cut -c1-2`
echo $count1
count2=`echo $count|cut -c2-3`
echo $count2
if [ $count1 != "0" -o $count2 != "0" ] ; then
echo "debug ppoint 1"
# sed -e "s/(0 rows affected)/There are no valid Deals to Report./g" ${TMP_FILE} > ${TMP_FILE}.edit
# mv ${TMP_FILE}.edit ${TMP_FILE}
# sed -e "/affected/d" ${TMP_FILE} > ${TMP_FILE}.edit
# mv ${TMP_FILE}.edit ${TMP_FILE}
echo debug4
sed -e "s/IamDeals_Id/IAM Deal Number/g" ${TMP_FILE} > ${TMP_FILE}.edit
mv ${TMP_FILE}.edit ${TMP_FILE}
sed -e "s/LoansDepositDeals_Id/PLD Deal Number/g" ${TMP_FILE} > ${TMP_FILE}.edit
mv ${TMP_FILE}.edit ${TMP_FILE}
sed -e "s/Currencies_ShortName/Currency of the Deal/g" ${TMP_FILE} > ${TMP_FILE}.edit
mv ${TMP_FILE}.edit ${TMP_FILE}
sed -e "s/Folders_ShortName/Folder Name/g" ${TMP_FILE} > ${TMP_FILE}.edit
mv ${TMP_FILE}.edit ${TMP_FILE}
echo "\nThe following Money Market IAM/PLD deals have been identified to contain different traded currency to the Folder Currency. " > ${MESG_FILE}
echo " _______________________________________________________________ \n" >> ${MESG_FILE}
if [ ! -s ${TMP_FILE} ] ; then
echo "None found." >> ${MESG_FILE}
else
cat ${TMP_FILE} >> ${MESG_FILE}
echo "\n _______________________________________________________________ " >> ${MESG_FILE}
echo "\n This is an automated email. Please call IT for more information. " >> ${MESG_FILE}
echo " _______________________________________________________________ " >> ${MESG_FILE}
fi
/usr/bin/mailx -r ldn-unix@list.lbb.de -s "MM IAM/PLD deals with different trade ccy to Folder" ${RECIPIENTS} < ${MESG_FILE}
else
echo "There are no valid Deals to Report." > ${MESG_FILE}
echo "\n _______________________________________________________________ " >> ${MESG_FILE}
echo "\n This is an automated email. Please call IT for more information. " >> ${MESG_FILE}
echo " _______________________________________________________________ " >> ${MESG_FILE}
/usr/bin/mailx -r ldn-unix@list.lbb.de -s "MM IAM/PLD deals with different trade ccy to Folder" ${ADMIN_RECIPIENTS} < ${MESG_FILE}
fi