10	FUNCTION INTEGER CHKRDB (TEST$)
	MAP (RDBAREA)	LONG	HOLDER,&
			LONG	HOLDER1,&
			LONG	IDENT,&
			LONG	RET_IDENT,&
			LONG	CONTEXT


	EXTERNAL INTEGER CONSTANT JPI$_UIC
	EXTERNAL INTEGER CONSTANT SS$_NORMAL
	EXTERNAL INTEGER FUNCTION SYS$ASCTOID
	EXTERNAL INTEGER FUNCTION SYS$FIND_HELD


	!	Form a Quadword identifier for this user
	CALL LIB$GETJPI (JPI$_UIC,,,HOLDER,,)
	HOLDER1 = 0%


	!	Form a Rights list ID for this RIGHT
	S1% = SYS$ASCTOID (TEST$,IDENT,)
	IF S1% <> SS$_NORMAL
	THEN
		!	Right does not exist, so this user doesn't have it
		CHKRDB = 0%
		EXIT FUNCTION
	END IF

	!	Start the search for the right
	CONTEXT = 0%
 LOOP:
	S1% = SYS$FIND_HELD(HOLDER,RET_IDENT,,CONTEXT)
	IF S1% <> SS$_NORMAL
	THEN
		CHKRDB = 0%
		EXIT FUNCTION
	END IF
	GOTO LOOP IF RET_IDENT <> IDENT


	!	Drop through means we found it
	CALL SYS$FINISH_RDB (CONTEXT)
	CHKRDB = 1%
	EXIT FUNCTION

 DONE:
	END FUNCTION
