!*! Updated on 28-Aug-90 at 4:23 PM by Matt Badger; edit time: 0:28:30
!*! Created on 10-May-90 at 2:00 PM by Matt Badger; edit time: 0:01:12




       map1 total'users,f,6
       map1 users
          map2 initls(1600),s,4
          map2 calls(1600),f,6
       map1 inline,s,4
       map1 filename,s,10
       map1 tempcalls,f,6
       map1 tempinitls,s,4

       print tab(-1,0)
       input "enter log file =>";filename
       open #2,filename,input
       total'users=1

loop:
       input line #2,inline
       if eof(2)=1 then goto round'up
       for count=1 to total'users
          if initls(count)=inline then goto old'user
       next count

new'user:
       print ".";
       total'users=total'users+1
       initls(total'users)=inline
       count=total'users

old'user:
       calls(count)=calls(count)+1
       goto loop

round'up:
       print tab(-1,0)
       print "Sorting data now........"
       for jcount=1 to total'users
          for icount=1 to total'users-jcount
             if calls(icount)<calls(icount+1) then call swap
          next icount
       next jcount
       print
       print "Writing file to disk now..."
       filename="sorted.log"
       input "enter output file =>";filename
       open #3,filename,output
       for count=1 to total'users
          print #3,initls(count),calls(count)
       next count
       print #3,total'users

       end

swap:
       tempcalls=calls(icount+1)
       tempinitls=initls(icount+1)
       calls(icount+1)=calls(icount)
       initls(icount+1)=initls(icount)
       calls(icount)=tempcalls
       initls(icount)=tempinitls
       return