      program extmosnoon
C......................................................Nov. 2019
C extract noon foF2 (for 10UT) 1958-1965
C
      DIMENSION ifc(32),IM(12)  ! noon foF2
	  CHARACTER*50 infile,outfile,txt
	CHARACTER*2 AYR,AMN,ADY,XX
	DATA  IM/31,28,31,30,31,30,31,31,30,31,30,31/
	xx='19'
C
      infile='d:\data\Mos\MOYR' ! 
	outfile='resmosnoon.txt'	 ! 
C	
	OPEN(11,file=outfile)

C++
C
   30 FORMAT(50X,I3)
   31 FORMAT(1X,3A2,1X,F4.1)
C  Year cycle 1958:1965
	iyr=57
  	 DO ii=1,8
	iyr=iyr+1
	call blet2(iyr,AYR)
	infile(15:16)=AYR
	OPEN(10,file=infile,action='READ')
C
	yr=float(iyr)
	if(int(yr/4.)*4.eq.iyr) THEN 
	im(2)=29
	ndnr=366
	                          ELSE
	IM(2)=28
	ndnr=365
	ENDIF
C
C  Month cycle 1...12
      DO imn=1,12
	call blet2(imn,AMN)
	idymn=im(imn) ! number of days/month
C Read noon foF2 for a monbth:
		read(10,*) txt ! title line
C Read 32 'noon' including median (line 32)
	do kk=1,32
	ifc(kk)=0
	READ(10,30,end=50) ifc(kk)
	enddo
		read(10,*) txt ! counts line
C day-to-day cycle
      DO idy=1,idymn
	call blet2(idy,ADY)
	if (ifc(idy).eq.0) ifc(idy)=ifc(32) ! missed value is replaced by median
	fnoon=ifc(idy)/10.
	write(*,31) AYR,AMN,ADY,fnoon
      write(11,31) AYR,AMN,ADY,fnoon
	ENDDO		  !
C
	ENDDO	! month
C
        ENDDO ! year
   50 close(unit=10)
      close(unit=11)
	pause ' '
	STOP
	END   