ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
c programa para conversao dos ficheiros ROA em format mag
c date time lon lat F dist
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
      program roa01
      character*50 file_roa,file_out,kdate*10,ctime*8
c
      namelist /par/ file_roa,file_out,kdate
c....................................................................... 
      open(unit=10, file='roa01.in', status='old')
      read(10,par)
      close(10)
c
      xlat=36.49722
      xlon=-6.119444
c
      open(unit=10,file=file_roa,status='old')
      open(unit=20,file=file_out,status='unknown')
      do 100 i=1,1000000
         read(10,*,end=999,err=999) tsec,fmag
         ddd=tsec/3600.
         ihh=int(tsec/3600.)
         tsec=tsec-float(ihh)*3600.
         imm=int(tsec/60.)
         tsec=tsec-float(imm)*60.
         iss=int(tsec)
         write(ctime,900) ihh,imm,iss
900      format(i2,':',i2,':',i2)
         do 10 k=1,8
           if (ctime(k:k).eq.' ') ctime(k:k)='0'
10       continue
         write(20,1000) kdate,ctime,xlon,xlat,fmag,ddd
1000     format(a10,1x,a8,1x,f12.7,1x,f11.7,1x,f7.1,1x,f7.3)
100   continue
  999 write(*,*) i-1,' lines in file'
      close(10)
      close(20)
c
      stop
      end
