COMPILE ROUTINE FIND_FUNCTION(SearchString)
ROWDEF(CHARSTR)


DECLARE FUNCTION UTILITY, Get_Repos_Entities
DECLARE SUBROUTINE Send_Info, Send_Dyn

$INSERT DICT_EQUATES
$INSERT EXPORTS_EQU

CONVERT @LOWER_CASE TO @UPPER_CASE IN SearchString

Result = ''

OPEN 'SYSPROCS' TO ProcsTable THEN
	SELECT ProcsTable
	
	Done = 0
	LOOP
		READNEXT @ID ELSE Done = 1
	UNTIL Done
		READ Record FROM ProcsTable,@ID THEN
			CONVERT @LOWER_CASE TO @UPPER_CASE IN Record
			
			IF INDEX(Record,SearchString,1) THEN
				LOCATE @ID IN Result BY 'AL' USING @FM SETTING Pos ELSE
					Result = INSERT(Result,Pos,0,0,@ID)
				END
			END
		END
	REPEAT
END


OPEN 'SYSREPOSEVENTS' TO ProcsTable THEN
	SELECT ProcsTable
	
		
	Done = 0
	LOOP
		READNEXT @ID ELSE Done = 1
	UNTIL Done
		
		READ Record FROM ProcsTable,@ID THEN
			CONVERT @LOWER_CASE TO @UPPER_CASE IN Record
			
			IF INDEX(Record,SearchString,1) THEN
				LOCATE @ID IN Result BY 'AL' USING @FM SETTING Pos ELSE
					Result = INSERT(Result,Pos,0,0,@ID)
				END
			END
			
		END
	REPEAT
END

DictTables = ''

OPEN 'SYSTABLES' TO TableTable THEN
	SELECT TableTable
	
	Done = 0
	LOOP
		READNEXT TableName ELSE Done = 1
	UNTIL Done
			IF TableName[1,5] = 'DICT.' THEN
				DictTables<1,-1> = TableName
			END	;* End of check for dictionary filename
	REPEAT
	
END

DictCnt = COUNT(DictTables,@VM) + (DictTables NE '')

FOR I = 1 TO DictCnt
	DictTable = DictTables<1,I>
	
	OPEN DictTable TO ActiveDict THEN
		SELECT ActiveDict
			
		Done = 0
		
		LOOP READNEXT DictKey ELSE Done =1 
		
		UNTIL Done
			READ DictRec FROM ActiveDict,DictKey THEN
				IF DictRec<DICT_TYPE$> = 'S' THEN
					Formula = DictRec<DICT_FORMULA$>
					CONVERT @LOWER_CASE TO @UPPER_CASE IN Formula
					
					IF INDEX(Formula,SearchString,1) THEN
						DictText = DictTable:' ':DictKey
						LOCATE DictText IN Result BY 'AL' USING @FM SETTING Pos ELSE
							Result = INSERT(Result,Pos,0,0,DictText)
						END
					END
				END
			
			END	;* End of DictRec Read
		REPEAT
		
	END	;* End of ActiveDict Open

NEXT I


OPEN 'EXPORTS' TO ExportTable THEN
	SELECT ExportTable
	
	Done = 0
	LOOP
		READNEXT ExportID ELSE Done = 1
	UNTIL Done
			READ ExportRec FROM ExportTable,ExportID THEN
				LOCATE SearchString IN ExportRec<EXPORTS_COLUMNS$> USING @VM SETTING Pos THEN
					ExportText = 'EXPORTS':' ':ExportID
					Result  = INSERT(Result,Pos,0,0,ExportText)
				END
			END
	REPEAT
	
END








rCnt = COUNT(Result,@FM) + (Result NE '')

FOR I = 1 TO rCnt
	Send_Dyn(Result<I>)
NEXT I

END


