!   new version      store data at the file store
!
!   N E W   C O D E   
!

%STRING(*) %FUNCTION BYTE TO HEX(%BYTE  A)

%const %string(1) %array   ian(0:15)= "0","1","2","3","4","5","6","7", %c
                            "8","9","A","B","C","D","E","F"
%result=ian(a//16).ian((a-((a//16)*16)))
%end

%ROUTINE MASTER

%on %event 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15 %start
%return
%finish

%if line="status" %then %start
print string("  30/04/85  apending version"); newline
write(ether station,7);write (command counter,8);newline
%return
%finish
command counter=command counter+1
comms(command counter)_line=line
comms(command counter)_re  =ether reads
comms(command counter)_time=cputime
comms(command counter)_wr  =ether writes

          %if command counter=10 %then %start
               command counter=-1
               
               open input(3,"im_pub:control")
               read(control)
               close input
               select input(0)
               %if control=1 %then %start
                  
                  open append(2,"im_pub:X".byte to hex(etherstation).File date)
                  select output(2)
                  re total=0; wr total=0
        
                  %for command counter=0,1,10 %cycle
                  re total=re total + comms(command counter)_re
                  wr total=wr total + comms(command counter)_wr
                  %repeat
                  write(re total,9); write(wr total,9)
                  newline
                  %for command counter=0,1,10 %cycle
                  write(ether station,3)
                  write(comms(command counter)_time,5)
                  write(comms(command counter)_re  ,5)
                  write(comms(command counter)_wr  ,5)
                  space
                  print string(comms(command counter)_line); newline
                  %repeat
                  close append
                  select output(0)
                  command counter=-1
               %finish
          %finish
ether writes=0
ether reads=0
%end 

master
!
!
!  END OF THE NEW CODE
!
!
