	SUBROUTINE SERSRC (LFULL)
C SEARCH THE RSPACES CORRESPONDING TO THE COMPOUNDS FROM THE INDEX
C MATCH
C
C	LFULL		FLAG SET TRUE IF OUTPUT FILE IS FULL
C
C	CALLED BY:	SEINDX
C	CALLS:		SEBCNT,SERHIT,SESAVE
C
	INCLUDE 'SEARCH.INC'
	INTEGER*2 SEBCNT
	DIMENSION IBUF(512),ISRCH(28,18),IBTST(6)
	EQUIVALENCE (ISRCH,IBUF)
C
	DATA IRS/7/		!OFFSET FOR RSPACE MAP
	DATA ICOD/26/		!OFFSET TO CODES
C READ RSPACE AND CODE RECORD, EACH RECORD IS 2 BLOCKS
	READ (ILUD'IBLOCK) (IBUF(I),I=1,256)	
	IBP = IBLOCK+1
	READ (ILUD'IBP) (IBUF(I),I=257,512)
	DO 100 IR=1,18
C TEST FOR SPECIAL CODES THAT MUST BE INCLUDED
	  IF ((ISRCH(ICOD,IR) .AND. IPCODE) .NE. IPCODE) GOTO 100
C TEST FOR SPECIAL CODES THAT MUST BE EXCLUDED
	  IF ((ISRCH(ICOD,IR) .AND. INCODE) .NE. 0) GOTO 100
	  IFGKNT = IFGKNT + 1		!COUNT # THAT PASSED FLAGS
C TEST FOR ENOUGH ELEMENT HITS
	  IEHITS = 0
	  DO 25 I=1,6
25	  IBTST(I) = ISRCH(I,IR) .AND. IELDET(I)
	  IEHITS = SEBCNT(IBTST,6)
	  IF (IEHITS .LT. NEHITS) GOTO 100		!NOT ENOUGH HITS
C TEST FOR EXCLUDED AND REQUIRED ELEMENTS
30	  DO 50 I=1,6
	    IF ((ISRCH(I,IR) .AND. IELEXC(I)) .NE. 0) GOTO 100
	    IF ((ISRCH(I,IR) .AND. IELREQ(I)) .NE. IELREQ(I)) 
     *		GOTO 100
50	    CONTINUE
	  IEMKNT =IEMKNT + 1		!COUNT # RSPACE SEARCHES
C ELEMENTS ARE A MATCH AND FLAGS ARE OK
C IF NO RSPACES WERE ENTERED, SAVE THE ENTRY
	  IF (NSPACE .LE. 0) THEN
	    IMATCH = IMATCH + 1
	    CALL SESAVE (IR,ISRCH(ICOD,IR),LFULL)
	    IF (LFULL) RETURN
	    GOTO 100
	  END IF
C RSPACES WERE ENTERED, SEE IF THEY MATCH RSPACES FOR THIS COMPOUND
	  CALL SERHIT (ISRCH(IRS,IR))
C SEE IF THERE ARE ENOUGH RSPACE MATCHES, IF THERE, TEST FIGURE OF MERIT
	  IF (ITOTBT .GE. IHMIN) THEN
	    IFMKNT = IFMKNT + 1		!COUNT # FOM CALCS
	    IFOM = IFOM*100/IFOMAX
	    IF (IFOM .GE. IPFOM) THEN
	      IMATCH = IMATCH + 1			!COUNT MATCH
	      CALL SESAVE (IR,ISRCH(ICOD,IR),LFULL)	!SAVE ENTRY
	      IF (LFULL) RETURN
	    END IF
	  END IF
100	  CONTINUE
	RETURN
	END
