Hi I need help below is my textfile format look like
PO Nbr Ln Item Number Description Qty Order Order Date Due Date Status Reply ID Reply Date Reply Qty
P304802 1 K0220040 TSX-3225 C 16.367900 MHz 320379 07/01/2008 29/01/2008 REQ OP304802 02/02/2008 190000
P304802 2 K0220040 TSX-3225 C 16.367900 MHz 0 07/01/2008 29/01/2008 REQ OP304802 04/02/2008 130379
I need to check in my unix script
(a) each POnbr must be unique
(b) one POnbr must be one Item Number
(c) the Qty Order must be tally with Reply Qty
and below is my unix script
set DATE=`date '+%y%m%d%H%M%S'`
#set mfgdb="crp3"
set mfgdb="prod"
set file="TMREPLY"
set epmhome="/home/int/${mfgdb}/oed"
set datfile="etth009.csv"
#set shellhome="/u4/home/it/itjob/batch"
#set shellname="bat_crp3"
set shellhome="/u4/home/it/itjob/batch"
set shellname="bat_prod"
set stat=0
echo "------------------------------------"
date
### file check (receive) ###
echo "### Check error file exist ###"
file ${epmhome}/receive/${datfile}*
set stat=${status}
if (${stat} != 0) then
echo "No Error File Found at Receive"
else
echo "Error File Found at Receive"
goto END_OF_PROCESS
echo "OK: `date '+%T'`"
endif
RECEIVE_LOOP:
### File check at receive folder ###
echo "### File check at receive ###"
file ${epmhome}/receive/${file}*
set stat=${status}
if ({$stat} != 0) then
echo "OK: `date '+%T'`"
echo "No Data at Receive folder"
goto NOMAL_END
endif
echo "OK: `date '+%T'`"
echo "### Check error file exist ###"
file ${epmhome}/receive/${datfile}*
set stat=${status}
if (${stat} != 0) then
echo "No Error File Found at Receive"
else
echo "Error File Found at Receive"
goto END_OF_PROCESS
echo "Error File Found: `date '+%T'`"
endif
### filename get ###
echo "### File load ###"
cd ${epmhome}/receive
set getfile=`ls ${file}* | head -1`
#set loadfile=`echo $getfile:r`
#echo "loadfilename="${loadfile}
### Copy File to archive ###
echo "### Copy file to archive folder ###"
cp ${epmhome}/receive/${getfile} ${epmhome}/archive/
### Send out email ###
echo "### Send e mail ###"
uuencode ${epmhome}/receive/${getfile} ${getfile}| mailx -s ETTH_REPLY_Data
twloh@epsontoyocom.com
### Change File Name ###
echo "### Move File name to etth009.csv ###"
mv ${epmhome}/receive/${getfile} ${epmhome}/receive/${datfile}
set stat=${status}
if ({$stat} != 0) then
echo "Move ERROR"
goto END_OF_PROCESS
endif
echo "OK: `date '+%T'`"
### MFG/Pro CIM load process ###
echo "### Reply format CIM Load ###"
${shellhome}/${shellname} "ETTH2"
set stat=${status}
if (${stat} != 0) then
echo "MFG/Prod Load Error"
goto END_OF_PROCESS
endif
echo "OK: `date '+%T'`"
echo "----------- RECEVE_LOOP ------------"
goto RECEIVE_LOOP
### Nomal End ###
NOMAL_END:
echo "### Nomal End ###"
set stat=0
echo "*-----------------------------------"
exit {$stat}
### End of process ###
END_OF_PROCESS:
set stat=1
echo "#-----------------------------------"
exit {$stat}
Please help me to check the validation in the unix script