      program catseason
C.......................................................Dec. 2021
C
      CHARACTER*128 INFHSS,outfjan,outfjul,outfeqn
C
      infhss='catdsthss3f.txt'  ! 380 HSS/Dst events t0 at Dst storm onset
      	open(10,file=infhss,action='READ')
C
		outfjan='cathssjan.txt'
	outfjul='cathssjul.txt'
	outfeqn='cathsseqn.txt'
	OPEN(11,file=outfjan)
	OPEN(12,file=outfjul)
	OPEN(13,file=outfeqn)
C
   28 format(1X,F8.3,1X,I3,3(1X,I2),1X,I4,2(1X,I4),1X,I3,2(1X,I4))
   29 format(1X,F8.3,1X,I3,3(1X,I2),1X,I4,2(1X,I4),1X,I3,3(1X,I4))
      icnjan=0
	icnjul=0
	icneqn=0
	DO 177 iev=1,380	!HSS/Dst storm 1996-2021
      read(10,28,end=27) ryear1,ldam,imn1,idy1,iutm,idstpeak,ivmin
	+,idelsw,idtsw,ivmax,ninp
C
      if ((imn1.eq.1).or.(imn1.eq.2).or.(imn1.eq.11).or.(imn1.eq.12)) 
	+then
	 icnjan=icnjan+1
	write(*,29)	ryear1,ldam,imn1,idy1,iutm,idstpeak,ivmin
 	+,idelsw,idtsw,ivmax,icnjan,ninp
      write(11,29)	ryear1,ldam,imn1,idy1,iutm,idstpeak,ivmin
 	+,idelsw,idtsw,ivmax,icnjan,ninp
	 goto 177
	endif
C
      if ((imn1.eq.3).or.(imn1.eq.4).or.(imn1.eq.9).or.(imn1.eq.10)) 
	+then
	 icneqn=icneqn+1
	write(*,29)	ryear1,ldam,imn1,idy1,iutm,idstpeak,ivmin
 	+,idelsw,idtsw,ivmax,icneqn,ninp
      write(13,29)	ryear1,ldam,imn1,idy1,iutm,idstpeak,ivmin
 	+,idelsw,idtsw,ivmax,icneqn,ninp
	 goto 177
	endif
C
      if ((imn1.eq.5).or.(imn1.eq.6).or.(imn1.eq.7).or.(imn1.eq.8)) 
	+then
	 icnjul=icnjul+1
	write(*,29)	ryear1,ldam,imn1,idy1,iutm,idstpeak,ivmin
 	+,idelsw,idtsw,ivmax,icnjul,ninp
      write(12,29)	ryear1,ldam,imn1,idy1,iutm,idstpeak,ivmin
 	+,idelsw,idtsw,ivmax,icnjul,ninp
	 goto 177
	endif
  177	CONTINUE
   27	close(10)
      close(11)
	close(12)
	close(13)
       pause	' '
	STOP
	 END
C


