Appendix F

Cash Inventory Program Source Code

#!/usr/local/bin/perl
#usage:
#Enter date and time as year month day hour minute second separated by spaces:
#parse_log 1996 4 19 21 11 43

      $inputfile = "paws.log";

open(INPUT, "<$inputfile");
$i = 0;
$money = 0;
$inyear = @ARGV[0];
$inmonth = @ARGV[1];
$inday = @ARGV[2];
$inhour = @ARGV[3];
$inminute = @ARGV[4];
$insecond = @ARGV[5];

while(){

if (substr($_,0,1) eq "N"){
@junk = split(/[\ \t\n]+/,$_);
@addtime = split(/[\:]+/,@junk[6]);
$month = @junk[4];
$day = @junk[5];
$year = @junk[8];
$hour = @addtime[0];
$minute = @addtime[1];
$second = @addtime[2];
if ($month eq "Jan"){$month = 1;}
if ($month eq "Feb"){$month = 2;}
if ($month eq "Mar"){$month = 3;}
if ($month eq "Apr"){$month = 4;}
if ($month eq "May"){$month = 5;}
if ($month eq "Jun"){$month = 6;}
if ($month eq "Jul"){$month = 7;}
if ($month eq "Aug"){$month = 8;}
if ($month eq "Sep"){$month = 9;}
if ($month eq "Oct"){$month = 10;}
if ($month eq "Nov"){$month = 11;}
if ($month eq "Dec"){$month = 12;}

if ((($year >= $inyear)&&($month >= $inmonth)&&($day >= $inday)&&($hour >= 
      $inhour)&&($minute >= $inminute)&&($second >= $insecond))||
    (($year >= $inyear)&&($month >= $inmonth)&&($day >= $inday)&&($hour >=
     $inhour)&&($minute >= $inminute)&&($second > $insecond))||
    (($year >= $inyear)&&($month >= $inmonth)&&($day >= $inday)&&($hour >=
     $inhour)&&($minute > $inminute))||
    (($year >= $inyear)&&($month >= $inmonth)&&($day >= $inday)&&($hour >
     $inhour))||
    (($year >= $inyear)&&($month >= $inmonth)&&($day > $inday))||
    (($year >= $inyear)&&($month > $inmonth))||
    (($year > $inyear))){$i=1;}
}else{
if ($i == 1){if (substr($_,9,2) eq "ii"){$money = $money + 5; $i = 0;}}
}#end else
}#end while
print "There is \$",$money,".00 in the box\n";

Example of the paws.log File to be Parsed

NEW RECORD on Tue Apr 23 14:40:40 EDT 1996
555091212ll is what we got from PAWS
0 is how much sgonzale needs to print
P+0.00  on Q is the line given to PAWS

NEW RECORD on Tue Apr 23 14:41:09 EDT 1996
555091212ii is what we got from PAWS
-5 is how much sgonzale needs to print
P+5.00  on Q is the line given to PAWS

NEW RECORD on Tue Apr 23 14:41:21 EDT 1996
555101212ll is what we got from PAWS
-0.35999999999999999 is how much mmartian needs to print
P+0.36  on Q is the line given to PAWS

NEW RECORD on Tue Apr 23 14:41:31 EDT 1996
555101212ii is what we got from PAWS
-5.3600000000000003 is how much mmartian needs to print
P+5.36  on Q is the line given to PAWS

NEW RECORD on Tue Apr 23 14:41:47 EDT 1996
555551212ll is what we got from PAWS
FBad ID    Q is how much noquota needs to print
FBad ID    Q is the line given to PAWS

NEW RECORD on Tue Apr 23 14:42:01 EDT 1996
555555555ll is what we got from PAWS
FBad ID    Q is how much BOGUS needs to print
FBad ID    Q is the line given to PAWS