!*! Updated on 01-Nov-90 at 3:39 PM by Steve Archuleta; edit time: 0:16:45
! Test version for pcount.bas
!
!

MAP1 in'file,S,10,""
MAP1 month,S,2
MAP1 count,F,6,0
MAP1 user'stats,S,22
MAP1 names(1000),S,4
MAP1 calls(1000),F,6
MAP1 max'call,F,6,0
MAP1 max'call'id,S,4
MAP1 unique'calls,F,6

       ? TAB (-1,0)
       ? TAB (3,5);
       INPUT "Input the file you would like to read: ",in'file

       OPEN #1,in'file,INPUT
       ? TAB (-1,29)

LOOP:   INPUT LINE #1,user'stats
       month=mid(user'stats,15,2)
       if eof(1) then GOTO FIND'MAX

       ? TAB(5,5) "Reviewing date " MID(user'stats,15,5)
       count = count + 1

       FOR I = 1 TO 1000
         if names(I) = "" then names(I) = left(user'stats,4) :&
           GOTO LOOP &
         else if names(I) = left(user'stats,4) then  &
              calls(I) = calls(I) + 1 : GOTO LOOP
       NEXT I

FIND'MAX:
       FOR I = 1 TO 1000
         unique'calls = I
         if names(I) = "" then GOTO PRINT'STATS
         if calls(I) > max'call then &
           max'call = calls(I) :&
           max'call'id = names(I)
       NEXT I

PRINT'STATS:
       if ucs(in'file) = "NETLOG.DAT" GOTO NETLOG'DAT
       if ucs(in'file) = "NETLOG.OLD" GOTO NETLOG'OLD

       ? TAB (5,5) "                    "
       ? TAB (5,5) "Reviewed month" month
       ? TAB (6,5) "Total phone count was" count
       ? TAB (7,5) "Number of unique callers was" unique'calls
       ? TAB (8,5) "Most frequent caller was " max'call'id;
       ? " with" max'call "calls."  :&
       GOTO END

NETLOG'DAT:
       ? TAB (5,5) "Total phone count for today is" count
       ? TAB (6,5) "Number of unique callers is" unique'calls
       ? TAB (7,5) "Most frequent caller is " max'call'id;
       ? " with" max'call "calls."  :&
       GOTO END

NETLOG'OLD:
       ? TAB (5,5) "Total phone count up to today is" count
       ? TAB (6,5) "Number of unique callers has been" unique'calls
       ? TAB (7,5) "Most frequent caller so far is" max'call'id;
       ? " with" max'call "calls."

END:
       ? TAB (-1,28) : END