 function rd_fdss_orbevt_fil, infile

;+
;NAME:
;       rd_fdss_orbevt_fil
;PURPOSE:
;       Read ORBEVT ASCII file and return orbevt structure.
;SAMPLE CALLING SEQUENCE:
;       rd_fdss_orbevt_fil('/tsw/dbase/ops/fdss/orbevt/19980215_0000.orbevt')
;HISTORY:
;       Written Nov-97 by F.Zele
;-

 out0 = {rd_fdss_orbevt, day: 0, time: 0L, orb: 0, anday: 0, antime: 0L, an: 0.0, apoday: 0,     $
         apotime: 0L, apo: 0.0, dnday: 0, dntime: 0L, dn: 0.0, perday: 0, pertime: 0L, per: 0.0}
 lines = rd_tfile(infile)
 n = n_elements(lines)
 out = replicate(out0,n)
 j = 0
 for i=0,n-1 do begin
   case 1 of
     (strpos(lines(i),':') ne -1) :             begin
        arr=str2arr(lines(i))
        out(j).orb  = arr(0)
        dattim = doytim2ints(strmid(arr(1),0,3) + strmid(arr(1),6,13),strmid(arr(1),4,2))
        out(j).day  = dattim.day
        out(j).time = dattim.time
        if arr(2) ne 'Not in Pass' then begin
          out(j).an = arr(3)
          dattim = doytim2ints(strmid(arr(2),0,3) + strmid(arr(2),6,13),strmid(arr(2),4,2))
          out(j).anday = dattim.day
          out(j).antime = dattim.time
        endif 
        if arr(4) ne 'Not in Pass' then begin
          out(j).apo = arr(5)
          dattim = doytim2ints(strmid(arr(4),0,3) + strmid(arr(4),6,13),strmid(arr(4),4,2))
          out(j).apoday = dattim.day
          out(j).apotime = dattim.time
        endif 
        if arr(7) ne 'Not in Pass' then begin
          out(j).dn = arr(8)
          dattim = doytim2ints(strmid(arr(7),0,3) + strmid(arr(7),6,13),strmid(arr(7),4,2))
          out(j).dnday = dattim.day
          out(j).dntime = dattim.time
        endif 
        if arr(9) ne 'Not in Pass' then begin
          out(j).per = arr(10)
          dattim = doytim2ints(strmid(arr(9),0,3) + strmid(arr(9),6,13),strmid(arr(9),4,2))
          out(j).perday = dattim.day
          out(j).pertime = dattim.time
        endif 
        j = j + 1
     end
   else: 
   endcase
 endfor
 out=out(0:j-1)
 return, out
 end

