return to PRS Technologies website
################################################################################
#
# Module: fix_winoutstat4.sh
#
# Description:
# Identify (do NOT delete) winoutstat records that point to missing Unix files
# or Unix files that have no winoutstat records
#
# Author: Peter R. Schmidt
#
# Change Log
#
# Date Person Description
#
# 03/28/2002 Peter Schmidt Start program
#
################################################################################
echo "Searching $REPORTDIR"
rm -f unix_files1.unl
rm -f missing_in_elite.unl
rm -f delete_rpt2.out
rm -f delete_rpt1.out
find $REPORTDIR -name "TEMP.*" -print > unix_files1.unl
dbaccess son_db <<-EOF
set isolation to dirty read;
!echo "create temp table: peter1 (contains list of files in unix)."
create temp table peter1 ( f1 char(100) );
!echo "Loading list of unix files into Informix table: peter1..."
load from "unix_files1.unl" insert into peter1;
create index peter1_1 on peter1 (f1);
!echo "create temp table: peter2 (contains list of files in elite)."
create temp table peter2 ( f1 char(100) );
!echo "Loading list of elite files into Informix table: peter2..."
insert into peter2 select wofile from winoutstat where wofile is not null;
create index peter2_1 on peter2 (f1);
!echo "Unload to missing_in_elite where file is in unix, but not in elite."
unload to "missing_in_elite.unl"
select f1 from peter1
where f1 not in (select f1 from peter2);
!echo "Unload winoutstat (used later to determine if Unix files are missing)"
unload to "winoutstat.unl"
select *
from winoutstat
where wofile IS NOT NULL
order by wodate0 desc
EOF
rm -f unix_files1.unl
echo
echo "Press to report on missing files found ( to quit )"
echo "(where file is in unix, but not in elite winoutstat)"
read answer
echo
echo "Reporting on files..."
echo "(where file is in unix, but not in elite winoutstat)"
echo
for FILENAME in `cat missing_in_elite.unl | cut -d"|" -f1`
do
ls -l $FILENAME >> delete_rpt2.out
done
echo
echo "Press to see files in unix, but not in elite winoutstat."
echo "(File is delete_rpt2.out)"
read answer
echo
pg delete_rpt2.out
#----------------------------------------------------------------------
echo
echo "Press to report on missing Unix files ( to quit )"
echo "(where file is in Elite winoutstat, but not in Unix )"
read answer
echo
echo "Checking files..."
echo "(where file is in Elite winoutstat, but not in elite Unix)"
echo
IFS="|"
while read WOINDEX WOUSER WOUSER1 WOREPORT WOTITLE WOFILE WODATE0 WOTIME0 WOSTAT1 WODESC1 WODATE1 WOTIME1 WOSTAT2 WODESC2 WODATE2 WOTIME2 WOFILE2 WOPID
do
if [ ! -f $WOFILE ]; then
echo "$WOINDEX $WOFILE $WOUSER $WODATE0" >> delete_rpt1.out
fi
done < winoutstat.unl
echo
echo "Press to see files in Elite winoutstat, but not in Unix."
echo "(File is delete_rpt1.out)"
read answer
echo
pg delete_rpt1.out
echo
echo "Completed"
################################################################################