return to PRS Technologies website
################################################################################
#
# Module: ck_glpost.sh
#
# Description: Check for glpost records where glpost.gpbatch is null
#
# This program will determine if any glpost records
# exist where the gpbatch field has not been successfully
# updated when the audit batch was finalized.
#
# Author: Peter R. Schmidt and Mary Ann Tracy
#
# Change Log
#
# Date Person Description
#
# 01/17/2005 Mary Ann Tracy Start Program
#
################################################################################
#
# if [ $# != 2 ]
# then
# echo "Usage: ck_glpost.sh"
# exit 1
# fi
#
################################################################################
if [ "x$INFORMIXDIR" = "x" ]
then
. /elite/custom/run.elite # Set the informix environment
fi
TMPFILE1=$DBTEMP/ck_glpost.tmp
rm -f $TMPFILE1
rm -f ck_glpost.out
cls
echo "Please wait... This may take several mintues."
###############################################################################
# Check for unbatched audit records, quit if records exist
AUCNT=`dbaccess son_db <<-EOF 2>/dev/null | egrep -v "count|retrieved|Database closed|^$"
select count(*)
from auditt
where aubatch is null;
EOF
`
if [ $AUCNT -gt 0 ]; then
echo
echo
echo "Warning: $AUCNT unbatched audit records exist."
echo
echo "Please include all audit records into batches and finalize."
echo
echo "Press to quit "
read answer
exit 0
fi
###############################################################################
# Check for unfinalized batches, quit if records exist
BTCNT=`dbaccess son_db <<-EOF 2>/dev/null | egrep -v "count|retrieved|Database closed|^$"
select count(*)
from batch
where bfindt is null;
EOF
`
if [ $BTCNT -gt 0 ]; then
echo
echo
echo "Warning: $BTCNT unfinalized batches exist."
echo
echo "Please finalize all batches and try again."
echo
echo "Press to quit "
read answer
exit 0
fi
###############################################################################
# Check for glpost records with null batch,
# if any exist, send count and audit batch info to ck_glpost.out
GLCNT=`dbaccess son_db <<-EOF 2>/dev/null | egrep -v "count|retrieved|Database closed|^$"
select count(glpost.gpnum)
from glpost
where glpost.gpbatch is null;
EOF
`
if [ $GLCNT -gt 0 ]; then
dbaccess son_db <<-EOF > ck_glpost.out 2>/dev/null
select count(glpost.gpnum) Count, auditt.aupert AuditPd, auditt.aubatch AuditBt
from glpost, auditt
where glpost.gpaudit=auditt.auindex
and auditt.aubatch is not null
and glpost.gpbatch is null
group by auditt.aupert, auditt.aubatch
order by auditt.aupert, auditt.aubatch;
EOF
echo
echo
echo "Warning: $GLCNT glpost records exist that have not been "
echo " successfully updated with a batch number."
echo
echo "Results have been recorded in ck_glpost.out."
echo
echo
echo "If no results are recorded in ck_glpost.out there may still"
echo "be a problem, please contact PRS Technologies for assistance."
echo
echo "Please press to continue."
read answer
pg ck_glpost.out
else
echo "No glpost records exist without batch numbers."
echo
echo "Please press to continue."
read answer
exit 0
fi
################################################################################