      program catkpdis
C........................................................Dec 2022
C Catalog of monthly Kp disturbed days 1964-2022
C
      character*64 infile,outfile
	character*4 AYEAR
	character*2 AMN,ADY
C
       infile='d:\Apkp\kpap\qddays19642022c.txt'
	outfile='catkpdis.txt'
	OPEN(10,file=infile,action='READ')
C-	read(10,*) txt
	OPEN(11,file=outfile)
   30 format(I2,1X,I4,47X,I2)
   31 format(1X,F8.3,1X,I3,2(1X,A2),1X,I4)
C
      ndy=0
      DO 100 iyear=1964,2022
	call blet4(iyear,AYEAR)
		iyr=iyear-iyear/100*100
		ryr=float(iyr)
		if(int(ryr/4.)*4.eq.iyr) THEN 
	ndr=366
	                          ELSE
	ndr=365
	ENDIF
C
       del=1./ndr
C
C-      DO imn=1,12
    1	READ(10,30,end=51) kmn,kyear,kpdy	
c-	if ((kyear.eq.iyear).and.(kmn.eq.imn)) then
	lda=ndoy(iyr,kmn,kpdy)
	ryear=iyear+(lda-1)*del
	call blet2(kmn,AMN)
      call blet2(kpdy,ADY)
	ndy=ndy+1
	write(*,31) ryear,lda,AMN,ADY,ndy
	write(11,31) ryear,lda,AMN,ADY,ndy
C-	exit
C-	                       else
C-	pause ' '
C-	endif
C-	ENDDO
          if (kmn.lt.12) GOTO 1
  100	CONTINUE
   51	close(10)
      close(11)
	pause ' '
	STOP
	END