!
if exist(all%list) delete /var all%list
if file(all%raw) then
  SAY "Searching in "'all%raw'
  sic find &1.uvt 'all%raw'
  define char sdir*64
  let sdir 'all%raw'
else
  define char sdir*4
  let sdir " "
endif
sic find 'sdir''all%filter'.uvt 
if dir%nfile.eq.0 return
!
define structure all%list /global
define integer nf
let nf dir%nfile
define real all%list%band[nf] all%list%vres[nf]  /global
define integer  all%list%nchan[nf] /global
define double all%list%freq[nf] /global
define character*4 all%list%code[nf] /global
define character*64 all%list%name[nf] /global
define real band
define character*64 short
!
for i 1 to nf  
  define head a 'dir%file[i]' read
  let band abs(a%nchan*a%freqres)
  let all%list%band[i] band
  let all%list%nchan[i] a%nchan
  let all%list%vres[i] abs(a%velres)
  let all%list%freq[i] (a%nchan/2-a%convert[1,1])*a%freqres+a%restfre 
  sic parse 'dir%file[i]' short
  let all%list%name[i] 'short'
  delet /var a
next
!
say "    File Name                    Bandwidth  Channels   Frequency   Resolution "
say "                                    (MHz)                (MHz)       (km/s)   "
for i 1 to nf
  say all%list%name[i] nint(all%list%band[i]) all%list%nchan[i] all%list%freq[i] all%list%vres[i] -
     /format A32 I10 I10 F12.3 F10.3 
next
!
define real bands /like all%list%band
define real minband nextband
define integer selfband
let bands all%list%band
compute minband max bands
let nextband minband
for /while nextband.gt.0.45*minband
  let bands 0 /where bands.gt.(nextband-30)
  compute nextband max bands
next
let selfband sqrt(minband*nextband)
say "Recommended bandwidth for Self-calibration > "'selfband'" MHz"
if exist(all%minband) let all%minband selfband
