
      program rdapprox
c
      character*80 flnm,rec80
      data lu/10/
c
      write(6,"('Enter file name: ',$)")
      read(5,"(a)") flnm
      len = lnblnk(flnm)
      open(lu,file=flnm,status="OLD",err=900)
      write(6,"('Opened file ',a)") flnm(1:len)
      npts = 0
c
c 4 line header:
      do ii=1,4
        read(lu,"(a)",end=901) rec80
      enddo
c
c Data:
      do ii=1,100000
        read(lu,"(i9,3f8.2)",end=901) isec,rlat,rlon,alt
        npts = npts+1
        ut = float(isec)/8640000.
        write(6,"(' npts=',i5,' ut=',f8.2,
     +    ' lat,lon,alt = ',3f8.2)") npts,ut,rlat,rlon,alt
      enddo

 901  write(6,"('EOF on file ',a,' npts = ',i5)") flnm(1:len),npts 
      stop
 900  write(6,"('Error opening file ',a)") flnm(1:len)
      stop
      end
c
c------------------------------------------------------------------
c
      function lnblnk(str)
      character*(*) str
c
c Return number of characters up to first occurrence of a blank
c
      lnblnk = 0
      lenstr = len(str)
      do 100 i=1,lenstr
        if (str(i:i).eq.' ') then
          lnblnk = i-1
          return
        endif
 100  continue
      lnblnk = lenstr
      return
      end
