      program compkp3ssn0
C......................................................Aug. 2021
C compare 8kp3 before 1996 with 8kp3 for SSN2=0 1996-2021
C
      dimension kpday1(663,0:7),kppre(0:7),kpcur(0:7)
      character*128 infilkp0,infilkp1,outfile
      character*2 BYR,BMN,BDY,AYRS(663),AMNS(663),ADYS(663)
C
      infilkp0='kp3ssn0_.txt' !Kp3 pre
	infilkp1='kp3ssn0.txt'	! kp3_cur
	outfile='compkp3ssn0.txt'
      OPEN(10,file=infilkp0,action='READ')
	OPEN(11,file=infilkp1,action='READ')
	OPEN(12,file=outfile)
	icnt0=0
	icnt1=0
C
   30	format(1X,I4,1X,3A2,8(1X,I3))
   31	format(3(1X,I4),2(1X,3A2),8(1X,I3))
C
      DO ii=1,663      ! Input 3kp daily SC23-SC24	 ~ kp_cur
C
   	read(11,30,end=150) nev,AYRS(ii),AMNS(ii),ADYS(ii)
	+,(kpday1(ii,k),k=0,7)
	ENDDO
  150	close(unit=11)
C
       nout=0
        DO 50 jpre=1,699
C included Kp >=3
   	read(10,30,end=151) nev_pre,byr,bmn,bdy,kppre
       iflag=0
      do jcur=1,663
	do k=0,7
	kpcur(k)=kpday1(jcur,k)
	enddo
C-	DO 39 k=0,7
	IF (kppre(0).eq.kpcur(0)) then
	  IF (kppre(1).eq.kpcur(1)) then
           IF (kppre(2).eq.kpcur(2)) then
		   IF (kppre(3).eq.kpcur(3)) then
	           IF(kppre(4).eq.kpcur(4)) then
			     IF(kppre(5).eq.kpcur(5)) then
       IF(kppre(6).eq.kpcur(6)) then
	  IF (kppre(7).eq.kpcur(7)) then 
	iflag=iflag+1
	jsour=jcur
	endif
	endif
	endif
	endif
	endif
	endif
	endif
	                   endif
C-  39	CONTINUE
	if (iflag.gt.0) then
	if (BYR(1:1).eq.' ') BYR(1:1)='0'
	if (BMN(1:1).eq.' ') BMN(1:1)='0'
	if (BDY(1:1).eq.' ') BDY(1:1)='0'
	nout=nout+1
      write(*,31) nout,jpre,jsour,BYR,BMN,BDY,AYRS(jsour),AMNS(jsour)
	+,ADYS(jsour),kppre
	write(12,31) nout,jpre,jsour,BYR,BMN,BDY,AYRS(jsour),AMNS(jsour)
	+,ADYS(jsour),kppre
	 exit
	   endif
   	enddo
C
   50 CONTINUE
  151 close(unit=11)
      close(unit=12)
	pause ' '
	STOP
	END
