      program extionolabut
C................................Aug 2019
C output in UT=0,1,23
	dimension ritec(0:23),iutout(0:23)
	integer itime
	CHARACTER*54,infile,outfile,txt
		CHARACTER*4 BYEAR,stat,AYEAR
	CHARACTER*2 AYR,AMN,BYR,BMN,BDY
	+,D1,D2
	CHARACTER*1 cc
	CHARACTER*8 xxyyzzzz ! xx=MN, yy=DD, zzzz=YEAR
	cc='%'
C 
c+	infile='GG140901.txt'
      infile='d:\Data\IONOLAB\statYEARMND1D2.txt'
C	stat='abmf'	   ! temp
	stat='mets'	   ! temp
	AYEAR='2002'   ! temp
	AMN='09'       ! temp
	infile(17:20)=stat
	infile(21:24)=AYEAR
	infile(25:26)=AMN
C
   1	write(*,*) 'Enter D1, D2 :'
	read(*,*) D1,D2
	infile(27:28)=D1
	infile(29:30)=D2
	AYR=AYEAR(3:4)

      outfile='statYRMMt.txt'
	outfile(1:4)=stat
	outfile(5:6)=AYR
	outfile(7:8)=AMN
C
		OPEN(12,FILE=OUTFILE,access='APPEND')
	OPEN(11,FILE=INFILE,action='READ')
  101	format(A54)
  102	format(2X,3A2,1X,A8,A8)
  103 format(X,3A2,24(1X,I4))
  107	format(A1,A54)
C
	read(11,101) txt ! extra line
C	write(12,107) cc,txt
	read(11,101) txt ! extra line
C	write(12,107) cc,txt
	rut=0.0
	iut=0
c  100	read(11,102,end=3) BYR,BMN,BDY,xxyyzz,tec
  100	read(11,*,end=3) xxyyzzzz,itime,tec
      BDY=xxyyzzzz(3:4)
	BMN=xxyyzzzz(1:2)
	BYEAR=xxyyzzzz(5:8)
	BYR=BYEAR(3:4)
	iutb=itime/10000
	if (iutb.eq.iut) then
	goto 2
	else
	goto 100
	endif
C
    2	ritec(iut)=tec
	iutout(iut)=nint(tec*10.)
      iut=iut+1
	if (iut.le.23) goto 100
	write(*,103) byr,bmn,bdy,(iutout(k),k=0,23)
	write(12,103) byr,bmn,bdy,(iutout(k),k=0,23)
      iut=0
	goto 100
   3	close(unit=11)
	close(unit=12)
1234	CONTINUE 	   ! day-to-day
C104	format(1X,3A2,24(1X,I4))
	pause ' '
	GOTO 1
C
	stop
	end