      program addeqkp0jm
C..Add EQ daily Mmax, Dkm, Mav, glat,glon set, for the day of Kpmax<3...........June 2022
C
      CHARACTER*64 infile,outfile,infileq
		CHARACTER*4 AYEAR
C	DIMENSION eqs(90),glats(90),glons(90),kmds(90),kms(90)
C
      outfile='addeqkp0jm.txt'
	infile='addeqkpssn0.txt'
	infileq='addeqkp3jm.txt'
C
       OPEN(10,file=infile,action='READ')
       OPEN(11,file=outfile)
 	OPEN(12,file=infileq,action='READ')
C
	ndy=0
C
	DO 41 iev=1,563
  	read(12,32,end=55) ryear2,lda2,imn2,idy2,glats2,glons2,kmds2
 	+,aeqmax2,eqav2,kk2,knum2,ndy2
            iyear2=int(ryear2)
  1  	read(10,32,end=50) ryear1,lda1,imn1,idy1,glats1,glons1,kmds1
	+,aeqmax1,eqav1,kk1,knum1,ndy1
C
      iyear1=int(ryear1)
C 
       call blet4(iyear,AYEAR)
	kk=0
      if ((iyear1.eq.iyear2).and.(lda1.eq.lda2)) then 
	goto 41
	else
C Output
    2  ndy=ndy+1
      write(*,32) ryear1,lda1,imn1,idy1,glats1,glons1,kmds1
	+,aeqmax1,eqav1,kk1,knum1,ndy
	write(11,32) ryear1,lda1,imn1,idy1,glats1,glons1,kmds1
	+,aeqmax1,eqav1,kk1,knum1,ndy
	 goto 1
	endif
C
   41 continue
   32 format(1X,F8.3,1X,I3,2(1X,I2),2(1X,F6.2),1X,I4,2(1X,F4.1)
     +,3(1X,I4))
   50	close(unit=10)
   55	close(unit=12)
	close(unit=11)
	pause ' '
	STOP
	END