Hello: Can anyone please decode this script in English. I have also made some comments which I know.. The actual script does not have one comment also..
#! /bin/ksh
. odbmsprd_env.ksh #setting the env..
echo $0 Started at : `date '+%d-%m-%Y %H:%M:%S'`
# what's echo $0
curdt=`date '+%Y%m%d%H%M%S'`
file=rpt
# why file=rpt
#what's $# ==3 -- I know we pass 3 parameters to the script and 3rd param is file name and 1st is startdate and 2nd is enddate.
if (( $# == 3 ))
then
echo arguments: $1 $2 $3
sql @rcvdata_p.sql $1 $2
file=$3
fi
# We are calling sql scripts to do some processing.
sql @rcvstmt3_p.sql
sql @rcvrep_p.sql
# We are checking number of lines in the file pur_jur.csv
lns=`cat pur_jur.csv|wc -l`
# If we have lines in the file, then do processing
if (( $lns > 0 ))
then
echo $lns records found in PURCHASE JOURNAL
# Debug into english the next line
sed 's/ //g' pur_jur.csv|sed 's/,//g'|sed 's/|/,/g' > pur_jur1.csv
# I understand the rest of the program
mv pur_jur1.csv pur_jur_"$file".csv
ftp_to_q_pnet.ksh pur_jur_"$file".csv
compress pur_jur_"$file".csv
mv /home/odbms/prod/cg_batch/purchase_journal/pur_jur_"$file".csv.Z /dataload/odbms/dataout/pur_jur_"$file".$curdt.csv.Z
else
echo No records found for Purchase Journal
rm pur_jur.csv
fi
echo $0 ended at : `date '+%d-%m-%Y %H:%M:%S'`