Listing of the Script
starttime=‘expr $now - $daysecs‘
if [ "$primary" = "project" ]; then
primarytitle="Project"
secondarytitle="User"
querystr="select \
acctstats.project,resources.username, \
acctstats.atime,acctstats.utime, acctstats.stime \
from resources,acctstats \
where acctstats.started > $starttime and resources.name=acctstats.name \
order by acctstats.project,resources.username"
elseprimarytitle="User"
secondarytitle="Project"
querystr="select \
resources.username,acctstats.project, \
acctstats.atime,acctstats.utime,acctstats.stime \
from resources,acctstats \
where acctstats.started > $starttime and resources.name=acctstats.name \
order by resources.username,acctstats.project"
fi
machine=‘rinfo -m‘
/bin/rm -f $tmpfile
$RMSQUERY $querystr > $tmpfile
if [ $? -ne 0 ]; then
echo "$sname : ERROR : $RMSQUERY $querystr FAILED"
exit 1
fi
cat $tmpfile | \
$AWK ’BEGIN {
primary = ""
secondary = ""
nvalues = 3
for (i=1; i<=nvalues; i++) {
values[i] = 0
primvalues[i] = 0
grandvalues[i] = 0
}
recs = 0
primrecs = 0
grandrecs = 0
printprim = 1
}
function printsortfields() {
if (printprim == 1) {
printf ("%-10.10s %-8.8s ", primary, secondary)
printprim = 0
} else {
Accounting Summary Script E-5