return to PRS Technologies website
###############################################################################
#
# Module: validate_period.sh
# Author: Peter R. Schmidt
# Description: Validate the Elite accounting period
# for use in shell scripts
#
# ARG 1 = period to validate
#
# RETURN 0 if valid
# RETURN 1 if invalid
#
# Change Log
#
# Date Name Description.................
# 03/03/01 Peter R. Schmidt Start Program
#
###############################################################################
if [ $# -ne 1 ]; then
echo "usage: validate_period.sh [ PERIOD ]"
exit 1
fi
. /elite/custom/run.elite
PERIOD=$1
CNT=`dbaccess son_db -</dev/null | egrep -v "count|retrieved|Database closed|^$"
select count(*) from periodt where pe = "$PERIOD" and petime = "OP";
EOF
`
if [ $CNT = 1 ]; then
exit 0
else
exit 1
fi
################################################################################