Check BENEFITS



#!/bin/ksh

###
### Scan BENEFIT file for any records that have a null COV-UPD-DT 
### Report the results via e-mail 
###
### Author: Michael Landis
###
###
### Contact Michael Landis if you would like a copy of a script
### (fixbenefit2.ksh) which automatically fixes bad records.
###

rngdbdump cai benefit -f COV-UPD-DT EMPLOYEE PLAN-CODE START-DATE STOP-DATE | \
grep ^"   " > /tmp/badbenrecs

if [ -s /tmp/badbenrecs ]
then
   cat /tmp/badbenrecs > /tmp/results
   echo " " >> /tmp/results
   echo "Run the /scripts/fixbenefit2.ksh script..." >> /tmp/results
   echo " " >> /tmp/results
   cat /tmp/results | mail -s "BAD BENEFIT RECORDS" youraddress@yourdomain.com
   rm /tmp/results
else
   rm /tmp/badbenrecs
   echo "BENEFITS file was OK..." | \
   mail -s "No Bad Benefit records..." youraddress@yourdomain.com
fi