      program extroutmn
C......................................................Nov. 2019
C extract IRI or IRI-Plas out foF2 (monthly x UT)
C
      DIMENSION fc(12,0:23)
	  CHARACTER*50 infile,outfile,txt
	CHARACTER*2 AYR,AMN,XX
	xx='19'
C      infile='testmos5865.out' ! CCIR=IRI-Plas
      infile='testmos5865s.out' ! Shubin ~ foF2(SSN2)
C	outfile='resmos5865.txt'	 ! CCIR=IRI-Plas
	outfile='resmos5865s.txt'	 !Shubin ~ foF2(SSN2)
	OPEN(10,file=infile,action='READ')
	OPEN(11,file=outfile)

C	do i=1,9	! CCIR=IRI-Plas
	do i=1,2  ! Shubin
	read(10,*) txt ! extra line
C	if (i.lt.9) then ! CCIR=IRI-Plas
	write(11,*) txt
C	endif            ! CCIR=IRI-Plas
	enddo
C
   30 FORMAT(3X,I2,1X,I2,73X,F6.2)
   31 FORMAT(1X,3A2,24(F6.2))
   32 FORMAT(6X,I2,5X,I2,45X,F6.2)
C  Year cycle 1958:1965
	iyr=57
  	 DO ii=1,8
	iyr=iyr+1
	call blet2(iyr,AYR)
	do kk=1,12
	do kkk=0,23
	fc(kk,kkk)=0.
	enddo
	enddo
C  Month cycle 1...12
      DO imn=1,12
	call blet2(imn,AMN)

C UT cycle
      DO iut=0,23
C	READ(10,30,end=50) kyr,kmn,fc(imn,iut) ! CCIR=IRI-Plas
	READ(10,32,end=50) kmn,kyr,fc(imn,iut) ! Shubin
	if (kyr.ne.iyr) pause ' '
	if (kmn.ne.imn) pause ' '
	ENDDO
	write(*,31) XX,AYR,AMN,(fc(imn,k),k=0,23)
      write(11,31) XX,AYR,AMN,(fc(imn,k),k=0,23)
	ENDDO	! month
C
        ENDDO ! year
   50 close(unit=10)
      close(unit=11)
	pause ' '
	STOP
	END   