	FUNCTION SEIBIT (IMAP,ILEN)
C FIND THE FIRST BIT SET IN IMAP
C
C	IMAP		BIT MAP TO BE SEARCHED
C	ILEN		# WORDS IN IMAP
C
C	CALLED BY:	SEINDX
C	CALLS:		NONE
C
	INCLUDE 'SEARCH.INC'
	INTEGER*2 SEIBIT
	DIMENSION IMAP(ILEN)
C FIRST FIND THE FIRST WORD THAT IS NOT ZERO
	DO 100 I=1,ILEN
	  IF (IMAP(I) .NE. 0) THEN		!BIT IS SET IN THIS WORD
C NOW FIND THE BIT THAT IS SET
	    DO 50 J=1,16
	      IF ((IMAP(I) .AND. IBITS(J)) .NE. 0) THEN
	        SEIBIT = (I-1)*16 + J		!RETURN THE NUMBER OF THE BIT
	        RETURN
	      END IF
50	    CONTINUE
	  END IF
100	  CONTINUE
C IF NO BITS ARE SET, RETURN THE BIT FOLLOWING THE END OF THE MAP
	SEIBIT = 16*ILEN+1
	RETURN
	END
