pro count_DB_files,log,tmin,tmax ; Last modified by C. See 5/7/98 ; Count the number of database files in each directory of a test log data base cd,'',current=cdir & cd,cdir ;csee 6/24/97 if n_params() eq 0 then log = cdir ;csee 6/24/97 outfile ='DB_file_count.out' ;csee 6/24/97 cmd=string(log,format='("ls ",a,"/DB")') spawn,cmd,dirs s=size(dirs) numdirs=0 if s(0) ne 0 then numdirs=s(1) close,1 ;csee 6/24/97 openw,1,outfile ;csee 6/24/97 printf,1,'Data Base file count for Log: ',log ;csee 6/24/97 print,log ans='' if n_params() lt 2 then read,'Is this a CO2 (y or n)? ',ans ;csee 7/14/97 if ans eq 'y' then goto,co2 ;csee 7/14/97 ans='' if n_params() lt 2 then read,'Is this a CO1 (y or n)? ',ans ;csee 5/7/98 if ans eq 'y' then goto,co1 ;csee 5/7/98 if n_params() lt 2 then begin for i=0,numdirs-1 do begin cmd=string(log,dirs(i),format='("ls ",a,"/DB/",a," | wc -l")') spawn,cmd,num print,dirs(i),num,format='(a,t11,i4)' printf,1,dirs(i),num,format='(a,t11,i4)' ;csee 6/24/97 endfor endif else begin reads,tmin,hr,min,sec,format='(i2,1x,i2,1x,f2.0)' time_min=3600.*hr+60.*min+sec reads,tmax,hr,min,sec,format='(i2,1x,i2,1x,f2.0)' time_max=3600.*hr+60.*min+sec for i=0,numdirs-1 do begin cmd=string(log,dirs(i),format='("ls ",a,"/DB/",a)') spawn,cmd,f s=size(f) if s(0) eq 0 and s(1) eq 7 then begin num=0 goto,next endif sort_by_mission_time,f,files s=size(files) numfiles=0 if s(0) ne 0 then numfiles=s(1) time=fltarr(numfiles) for j=0,numfiles-1 do begin s_time=strmid(files(j),13,13) reads,s_time,hr,min,sec,format='(i2,1x,i2,1x,f7.4)' time(j)=3600.*hr+60.*min+sec endfor index=where(time le time_max and time ge time_min) if index(0) eq -1 then begin num=0 endif else begin s=size(index) num=s(1) endelse next: print,dirs(i),num,format='(a,t11,i4)' printf,1,dirs(i),num,format='(a,t11,i4)' ;csee 6/24/97 endfor endelse goto,exit ; This section was added specifically for Checkout 2's ;csee 7/14/97 co2: expected = [16,2,1,96,0,0,0,7,36,1,27,127,250,13,0,3,20,48,0,0,1,0,110,88,57,57,1] if n_params() lt 2 then begin print,'File Type No. Expected Shortage' printf,1,'File Type No. Expected Shortage' for i=0,numdirs-1 do begin cmd=string(log,dirs(i),format='("ls ",a,"/DB/",a," | wc -l")') spawn,cmd,num print,dirs(i),num,expected(i),expected(i)-num,format='(a,t11,i4,2i9)' printf,1,dirs(i),num,expected(i),expected(i)-num,format='(a,t11,i4,2i9)' endfor endif else print,'***Error in input, try again!***' goto,exit ; This section was added specifically for Checkout 1's ;csee 5/7/98 co1: expected = [' 0 ',' 0 ',' 0 ',' 85-100','115-125',' 0 ',' 0 ',' 0 ',$ ' 60-65 ',' 0 ','570-590','215-225','120-130',' 15-25 ',' 0 ','160-210',$ ' 0 ','125-140','220-230',' 0 ',' 0 ',' 0 ',' 207 ','420-480','770-800','770-800'] test_lo = [0,0,0,85,115,0,0,0,60,0,570,215,120,15,0,160,0,125,220,0,0,0,207,420,770,770] ;min values test_hi = [0,0,0,100,125,0,0,0,65,0,590,225,130,25,0,210,0,140,230,0,0,0,207,480,800,800] ;max values if n_params() lt 2 then begin print,string(10b),'File Type No. Expected Result' printf,1,'File Type No. Expected Result' for i=0,numdirs-1 do begin cmd=string(log,dirs(i),format='("ls ",a,"/DB/",a," | wc -l")') spawn,cmd,num num=fix(num(0)) result='OK' if num lt test_lo(i) then result='Low' if num gt test_hi(i) then result='High' print,dirs(i),num,expected(i),result,format='(a,t11,i4,t18,a7,t30,a)' printf,1,dirs(i),num,expected(i),result,format='(a,t11,i4,t18,a7,t30,a)' endfor endif else print,'***Error in input, try again!***' exit: close,1 ;csee 6/24/97 cd, cdir ;csee 6/24/97 print,'' print,'Have a nice day! :) end