PRO cloqlfil,year,month,day,debug=debug;,qlunits ; This procedure closes all the quick-look files opened by ; iniqlfil.pro. After closing them, it looks for any ; previously-existing quick-look files from the given date, and ; concatenates them appropriately with the newly-closed files. It ; them sorts them (using the existing Unix tools), discarding any ; redundant lines, to produce time-ordered quick-look data files ; for the given date. @isitdos CD,qlroot ; These lines are no longer needed, as the temporary 'ql' files are ; opened just before writing and closed immediately afterward. ; FOR j=0,N_ELEMENTS(qlunits)-1 DO BEGIN ; qlu=qlunits(j) ; CLOSE,qlu ; FREE_LUN,qlu ; ENDFOR FOR ic=0,1 DO BEGIN FOR ifilt=0,4 DO BEGIN tfn=STRING(ic,ifilt,FORMAT='("tmp",2I1,".ql")') fn=STRING(year MOD 100,month,day,ic,ifilt $ ,FORMAT='(3I2.2,2I1,".ql")') foundfn=rFINDFILE(fn,COUNT=nfn) IF nfn GT 0 THEN BEGIN IF dos THEN BEGIN SPAWN,'copy '+fn+'+'+tfn+' tmpql' SPAWN,'sort < tmpql > '+fn ENDIF ELSE BEGIN SPAWN,'cat '+fn+' '+tfn+' >! tmpql' SPAWN,'sort -nu +0 -1 tmpql >! '+fn ENDELSE ; SPAWN,rmcmd+tfn IF KEYWORD_SET(debug) THEN $ MESSAGE,tfn+' merged with '+fn,/INFORMATIONAL del,tfn ENDIF ELSE BEGIN SPAWN,mvcmd+tfn+' '+fn IF KEYWORD_SET(debug) THEN $ MESSAGE,tfn+' renamed '+fn,/INFORMATIONAL ENDELSE ENDFOR ENDFOR ftmp=rfindfile('tmpql') IF ftmp(0) NE '' THEN del,ftmp(0) CD,root RETURN END