c************
c
c************
      program READSV

      implicit none
      include 'primitive.inc'

      record /HEADER/ HSV
      real*8 svin(9,8641) ! Minimum 10 sec delta for SV's
      integer*4 i, ngot, nel1

      call M$CHECKIN

      write(*,*) 'Pause after checkin',MC.pause,'tol',MC.tolerance
      call m$info('Loading SV file: '//M$APICK(1))
      call M$INIT (HSV, M$APICK(1), '5001', ' ', 0)
      call M$OPEN (HSV, HCBF_INPUT)

      call M$SYNC
      write(*,*) 'Pause after sync',MC.pause
      
      
      call m$grab(Hsv, svin, 1d0, nint(Hsv.size), ngot)
      nel1 = nint(86400d0 / Hsv.xdelta) + 1

      print *,'ngot/nel1 = ',ngot,'/',nel1
      do i = 1, ngot
        write(*,*)'El ',i,' = ',svin(1,i),' ',svin(2,i),' ',svin(3,i)
      enddo

      
      call M$CLOSE (HSV)
      call M$RETURN
      end
