fordatum.f


c     pre-datum
C      cut data during course change dhead>10
      open(10,file='gh90a.datas1',status='old')
      open(20,file='gh90a.latlon')
      iend=99
      aend=99.999
c
c
c      data read gh##s1
c
c     **** data ****
c     iyr:Year, jdy:Julian day, min:time(GMT in minutes),
c     alat(latitude TKY deg), alon(longitude TKY deg),
c     spd:speed, hg:course(clockwise from North), 
c     idpc:corrected depth, mgt:total magnetic force,
c     mga:magnetic anomaly, 
c     iflg:0--on line, 1--change course, 3--gap time
c
    1 continue
         read(10,*,end=99) no,iyr0,jdy0,min0,alat,alon,
     +   spd0,hg0,idpc0,mgt0,mga0,gr0,gt10,ga0,iflg
      if(no.eq.0) then
       go to 1
      end if
c
      llon=int(alon)
      blon=(alon-llon)*60
      mlon=int(blon)
      clon=(blon-mlon)*60
c
      llat=int(alat)
      blat=(alat-llat)*60
      mlat=int(blat)
      clat=(blat-mlat)*60
c
        write(20,200) llat,mlat,clat,llon,mlon,clon
c
      go to 1
   99 continue
         write(20,200) iend,iend,aend,iend,iend,aend
      close(10)
      close(20)
  200 format(i3,i3,f7.3,i4,i3,f7.3)
c
      stop
      end