	Program Read_Data_t
	implicit none
c     .. local scalars ..
	character(256) filenameout
	character(256) filename_inp, filename
	character(256) dir_input,title
	logical check_data
	integer day,month,year
      integer DOY
      integer iyear,imonth,iday,iDOY
      integer hour_UT, min_UT, sec_UT
      real UT, delta_UT, UT_cur
      real ASYD,ASYH,SYMD,SYMH
	integer ninp, nout, nf
	data ninp,nout,nf/2,3,4/
c     .. function references ..
	real SYM_H
c	
CSh	filenameout = 'Output\Test_Read_Data.out'
	filenameout = 'Output\Test_Read_Data_m.out'
      open(nout,file=filenameout)
	write(nout,100)
c
      open(ninp,file='Input\Test_Read_Data.inp',status='old')
      read(ninp,*)
      read(ninp,*) day,month,year,hour_UT,min_UT,delta_UT,filename_inp
      UT = hour_UT + min_UT/60.0     
c      
      dir_input = 'Data_SYM\'
      filename = trim(dir_input)//filename_inp

      open(nf,file=filename)
	read(nf,*) title       ! TG
CSh      read(nf,10)        
            
      call nnday(day,month,year,DOY)
c       
      do while(.not.eof(nf))
CSh         read(nf,20) iyear,imonth,iday,hour_UT,min_UT,sec_UT,iDOY,
CSh     &                                        ASYD,ASYH,SYMD,SYMH 
         read(nf,21) iday,imonth,iyear,imonth,hour_UT		!TG
     &                                        ,SYMH 			!TG
c
CSh         UT_cur = hour_UT + min_UT/60.0 + sec_UT/3600.0
        UT_cur = hour_UT             !TG   
         check_data =.false.     
	   if (year/=iyear) then
	      exit
	   end if
c         if (abs(UT_cur-UT)>delta_UT) then
c	      continue
c		    cycle
c         else
	     SYM_H = SYMH
c	   end if  
	   write(nout,101) iday,imonth,iyear,UT_cur,SYMH
c	   UT = UT + 1
      end do
	
	if (check_data) then   
	   write(nout,*) 'No data'
	end if 

      close(nf) 	
c	
	stop
  10  format(14(/))
  20  format(i4,4(1x,i2.2),2x,f5.1,1x,i3,3x,4(3x,f7.2))
  21  format(2(2X,I2),3X,I4,3X,F6.2,2X,F7.2)		   !TG
 100  format(1x,'Day Month Year      UT     SYM_H')
 101  format(2x,2(i2.2,2x),1x,i4,2x,f7.2,2x,f7.2)
	end			