Sorry still don't get it, new at this stuff
when I have the shl like this one, it worked, it is only when I try to code to send emails,
Code:
#!/bin/ksh
#Retrieves and processes CSS IDOC file, then e-mails appropriate users
set -x
SID="$1";
SIDQ="@${SID}";
ORAENV_ASK=NO; export ORAENV_ASK
PATH=/usr/bin:/bin:/etc:/usr/sbin:/usr/ccs/bin:/usr/ucb:$HOME/bin:/usr/bin/X11:/sbin:.:/usr/lbin:$ORACLE_HOME/bin:/usr/local/bin
export PATH
ORACLE_SID=${SID}; export ORACLE_SID; . oraenv
#waiting for account
UID_F="xxxxxx";
PW_F="xxxx";
# set job name
JOBNAME="rypidoc_shl"
# set home directory path
MPATH=$BANNER_HOME;
SCRIPT_PATH="${MPATH}/xxxxx/plus/"
SQL_SCRIPT1="@rypidoc_loadcss_run.sql"
SQL_SCRIPT2="@rypidoc_process2_run.sql"
#rm idochd1.lst htfn1.file htfn2.file 2> /dev/null
#Section One - Download from Website
#Section Two - Identify file(s) to process, process and rename
cd "${MPATH}/xxxxx/dat_files"
#Determine if there is a file to process
ls 3526*.dat > /dev/null 2>&1
if [ $? != 0 ]
then
exit
fi
for i in 3526*.dat
do
# Capture just the file sequence number
fseqno=`print $i | sed 's/.*_//' | sed 's/.dat//' `
cd "${MPATH}/xxxx/dat_files"
echo $i `date` > idochd1.lst
cp $i idoc.dat
# Load file into tables RYRIDOC_COVER, RYRIDOC_IMAGE, RYRIDOC_TAXDATA, RYRIDOC_W2
##cd $SOFTPATH/script
# Change dir to where the sql scripts are
cd ${SCRIPT_PATH}
sqlplus -s ${UID_F}/${PW_F}${SIDQ} ${SQL_SCRIPT1} $fseqno >>${LF1} ${UID_F} 2>>${LF2}
# Process
##cd $SOFTPATH/script
###sqlplus / @$SOFTPATH/script/rypidoc_process2_run.sql
cd ${SCRIPT_PATH}
sqlplus ${UID_F}/${PW_F} ${SQL_SCRIPT2} >>${LF1} 2>>${LF2}
##cd $SOFTPATH/data/finaid/idoc
cd "${MPATH}/xxxxx/dat_files"
mv $i $i.processed
#Notify User
##cd $SOFTPATH/bin
##asysmail idoc.mail "CSS IDOC file received and processed" $SOFTPATH/log/rypidoc_process2.log
echo "\nEmail sent to ${MAILING_LIST} Loading Process Finish." >>${LF1} 2>>${LF2}
# Find the last error file for each type
tfn1=$( ls -1t ${MPATH}/xxxxx/dat_files/idoc_nomatch* | grep -v BAN1bat| head -1 )
#Determine if tfn1 has any records-if so, send
count=`cat $tfn1 | wc -l `
if [ $count != 0 ]
then
cat ${MPATH}/xxxxx/dat_files/idochd1.lst $tfn1 > ${MPATH}/xxxx/dat_files/htfn1.file
##asysmail idoc.mail "CSS IDOC-No Match File" $SOFTPATH/data/finaid/idoc/htfn1.file
fi
tfn2=$( ls -1t $${MPATH}/xxxx/dat_files/idoc_error* | grep -v BAN1bat| head -1 )
#Determine if tfn2 has any records-if so, send
count=`cat $tfn2 | wc -l `
if [ $count != 0 ]
then
cat $${MPATH}/xxxx/dat_files/idochd1.lst $tfn2 > $S${MPATH}/xxxxx/dat_files/htfn2.file
##cd $SOFTPATH/bin
###asysmail idoc.mail "CSS IDOC-Error File" $SOFTPATH/data/finaid/idoc/htfn2.file
fi
done
exit