program agn c****************************************************************** c c accgen program to calculate charging rates and write the c relevant output files needed for task building the c accounting system (version 7). c c s.m. thompson, february 1980 c c revision history c ---------------- c c SMT717 15-jul-81 fix bug which caused errors in the output c file rates.cmd for certain values of the c input charges. c c SMT724 27-jul-81 added page charge request (cost per page c printed) c c SMT774 24-oct-81 added support for memory usage charges c c SMT775 24-Oct-81 Allowed for zero charges and only give the c "is this good enough" message if the actual c and desired charge differ by more than half c a percent. c c****************************************************************** c dimension ibuf(8) integer*4 ibest,jbest real mem,memu,mem1 byte char equivalence (itick,ibuf(8)) data unit /0.0001/ ! Internal to external unit conversion c call gtim(ibuf) ! get clock frequency ticku = 3600.0*float(itick)*unit c c open .cmd file (included at task build in acc v7) c open(unit=2,name='RATES.CMD',type='NEW',form= 1 'FORMATTED') c c-------connect time rate c 10 write(1,500) 500 format(/,' Enter connect time rate (per hr.): ',$) ibest = 0 jbest = 1 read(1,*,end = 15,err = 10) conn if(conn.eq.0)go to 15 call rate(conn,ticku,ibest,jbest,conn1) if(abs(conn1/conn-1.0).lt.0.005)go to 15 write(1,501) conn1 501 format(/,' Nearest I can do is',f7.3,'/hr. Will this do?',$) read(1,502) char 502 format(a1) if(char.ne.'Y'.and.char.ne.'y')go to 10 15 close(unit = 1) call put('$CON1',ibest) call put('$CON2',jbest) c c-------cpu rate c 20 write(1,505) 505 format(/,' Enter CPU rate (per hr.): ',$) ibest = 0 jbest = 1 read(1,*,end = 25,err = 20) cpu if(cpu.eq.0.0)go to 25 call rate(cpu,ticku,ibest,jbest,cpu1) if(abs(cpu1/cpu-1.0).le.0.005)go to 25 write(1,507) cpu1 507 format(/,' The closest I can make it is',f7.3,'/hr. Will this 1 do? ',$) read(1,502) char if(char.ne.'Y'.and.char.ne.'y') go to 20 25 close(unit = 1) call put('$CPU1',ibest) call put('$CPU2',jbest) c c-------i/o request rate c 30 write(1,510) 510 format(/,' Enter rate per 1,000,000 I/O requests: ',$) ibest = 0 jbest = 1 read(1,*,end = 35,err = 30) qio if(qio.eq.0.0)go to 35 call rate(qio,1.0E6*unit,ibest,jbest,qio1) if(abs(qio1/qio-1.0).lt.0.005)go to 35 write(1,511) qio1 511 format(/,' Nearest I can do is',f7.3,' per M. Will this do?',$) read(1,502) char if(char.ne.'Y'.and.char.ne.'y')go to 30 35 close(unit = 1) call put('$QIO1',ibest) call put('$QIO2',jbest) c c-------disk rate c 40 write(1,515) 515 format(/,' Enter disk rate per Megabyte per week: ',$) ibest = 0 jbest = 1 read(1,*,end = 45,err = 40) disk if(disk.eq.0.0)go to 45 disku = 7.0*24.0*60.0*2000.0*unit call rate(disk,disku,ibest,jbest,disk1) if(abs(disk1/disk-1.0).lt.0.005)go to 45 write(1,517) disk1 517 format(/,' Nearest I can do is',f7.3,'. Will this do?',$) read(1,502) char if(char.ne.'Y'.and.char.ne.'y')go to 40 45 close(unit = 1) call put('$DSK1',ibest) call put('$DSK2',jbest) c c-------page charge c 50 ipag1=0 write(1,520) 520 format(/,' Enter charge per printed page: ',$) read(1,*,end = 55,err = 55) page if(page.ge.0.0.and.page.lt.3.276)go to 54 write(1,521) 521 format(' AGN -- Invalid response') go to 50 54 ibest=int(page/unit) 55 close(unit = 1) call put('$PAG1',ibest) call put('$PAG2',1) c c-------Memory rate c 60 write(1,525) 525 format(/,' Enter memory usage charge per KW-Hour: ',$) ibest = 0 jbest = 1 read(1,*,end = 65,err = 60) mem if(mem.eq.0.0)go to 65 memu = 1024.0*3600.0/64.0*unit call rate(mem,memu,ibest,jbest,mem1) if(abs(mem1/mem-1.0).lt.0.005)go to 65 write(1,527) mem1 527 format(/,' Nearest I can do is',f7.3,'. Will this do?',$) read(1,502) char if(char.ne.'Y'.and.char.ne.'y')go to 40 65 close(unit = 1) call put('$MEM1',ibest) call put('$MEM2',jbest) close(unit = 2) call exit end c c*************************************************************************** c subroutine put(str,i) byte str(5) c alog8(x) = alog(x)/alog(8.0) c j=i if(i.eq.0)j=1 ndigit = int(alog8(float(j))+1.001) write(2,10) str,i 10 format(' GBLDEF = ',5a1,':',o) return end c c************************************************************************** c subroutine rate(dollar,ticku,ibest,jbest,best) integer*4 ibest,jbest,i,j ratio = dollar/ticku ratb = 1.0e6 do 10 i = 75,1,-1 j = float(i)/ratio+0.5 rat = float(i)/float(j) if(abs(rat-ratio).gt.abs(ratb-ratio))go to 10 ratb = rat ibest = i jbest = j 10 continue best = ticku*float(ibest)/float(jbest) return end