	program cntrnkc
C "cnt-rnk" count D-, D+ Q DAYS FROM CATALOG
c20 REM INPUT c:\DATA\2006\xxYRMN.cat= OUTPUT
      DIMENSION RF2(150),RES(3),IDAT(31,3)
	CHARACTER*95 RF2,RES,infile,TXT,outfile
	CHARACTER*4 year
	CHARACTER*2 ayr,amn
	CHARACTER*1 SP,SN,SQ,SS
	SP='+'
	SN='-'
	SQ='*'
      YEAR='2026' 
	AYR=YEAR(3:4)
	AMN='07'
c50 REM INPUT "ENTER YEAR$  :",YEAR$
c60     INPUT "ENTER MN$    :",MN$
      read(ayr,*) YR
       read(amn,*) MN
      infile='c:\2026\IDCE\ZZ0901.cat'
	infile(6:7)=ayr
	infile(16:17)=ayr
	infile(18:19)=amn
	outfile=infile
	outfile(21:23)='res'
		OPEN(111,FILE=INFILE)
	OPEN(112,FILE=OUTFILE,ACCESS='APPEND')


  100 continue
      RES(1)='D+ '
      RES(2)='D- '
      RES(3)='Q  '
      DO J=1,3
      DO K=1,31
      IDAT(K,J)=0
	ENDDO
      ENDDO
C

  200 DO 190 L=1,150
	read(111,210,end=240,err=220) txt
  210 FORMAT(1X,A95)
      write(*,210) txt
	rf2(L)=txt
	i1=1
	do 230 i=1,31
	i1=i1+3
	SS=txt(i1:i1)
	if (SS.eq.SP) then 
	idat(i,1)=idat(i,1)+1
	goto 230
	endif
	if (SS.eq.SN) then 
	idat(i,2)=idat(i,2)+1
	goto 230
	endif
	if (SS.eq.SQ) then 
	idat(i,3)=idat(i,3)+1
	goto 230
	endif
230   CONTINUE
190	CONTINUE
	goto 240
 220	write(*,*) 	'Error in input data'
	pause ' '
	STOP
240   CONTINUE
C output of results
	do j=1,3
	write(112,300) res(j),(idat(k,j),k=1,31)
	write(*,300) res(j),(idat(k,j),k=1,31)
  300	format(1X,A3,31(1X,I2))
	enddo
  340 CLOSE(unit=112)
       pause ' '
   	STOP
	end
