! ----- GET_HELD_MASTER_IDENTIFIERS.FUN ----- ! ! ----- Subroutine to calculate Division(s) and Database(s) from ----- ! ----- this User's Divisional MASTER_div Identifier(s) and ----- ! ----- MASTER_nnn Identifiers which are held ----- ! ! ---------- PASSED: ---------- ! ! ----- UIC = UIC of user to get held identifiers for ! ! ----- PRIVILEGED = TRUE if user holds SETPRV privilege ! ! ----- DIVISION_NAMES() = List of all valid divisions ! ! ---------- RETURNED: ---------- ! ! ----- HELD_DIVS_CTR = Count of held MASTER_div identifiers ! ----- n/a if privileged) ! ! ----- HELD_DIVS(1->HELD_DIVS_CTR) = Held MASTER_div ! ----- identifiers (n/a if ! ----- privileged) ! ! ----- HELD_DBS_CTR = Count of held MASTER_nnn database ! ----- identifiers (n/a if privileged) ! ! ----- HELD_DBS(1->HELD_DBS_CTR) = Held MASTER_nnn database ! ----- number identifiers (n/a if ! ----- privileged) ! ! ----- Last Change 07/16/93 by Brian Lomasky ----- ! SUB GET_HELD_MASTER_IDENTIFIERS %INCLUDE "NUSER.INC" ! ----- SYSTEM SERVICE ERROR CODES AND FUNCTION VALUES ----- EXTERNAL LONG CONSTANT SS$_NOSUCHID ! NO IDENTIFIER FOUND DECLARE LONG CONTEXT ! CONTEXT FOR REPEATED CALLS DECLARE LONG ID ! IDENTIFIER VALUE DECLARE WORD ID_NAME_LENGTH ! LENGTH OF ID_NAME DECLARE LONG LOCAL_STATUS ! LOCAL SYSTEM SERVICE EXIT STAT DECLARE STRING MASTER_DIV ! DIVISION FROM MASTER_ddd IDENT DECLARE LONG MASTER_INDEX ! DIVISION INDEX FOR MASTER_ddd DECLARE WORD RECORD_FOUND ! TRUE IF MATCHING RECORD FOUND ! ----- MAPPED VARIABLE FOR SYS$FIND_HELD SYSTEM SERVICE ----- MAP (HOLDQUAD) LONG HOLDER(1%) ! HOLDER UIC QUADWORD ! ----- MAPPED VARIABLE FOR SYS$IDTOASC SYSTEM SERVICE ----- MAP (IDNAME) STRING ID_NAME=32% ! IDENTIFIER NAME BUFFER EXTERNAL WORD FUNCTION NUMERIC( & STRING) ! CHECK FOR NUMERIC STRING EXTERNAL LONG FUNCTION & SYS$FIND_HELD ! FIND IDENTIFIER THAT IS HELD EXTERNAL LONG FUNCTION & SYS$FINISH_RDB ! TERMINATE RIGHTS DATA CONTEXT EXTERNAL LONG FUNCTION & SYS$IDTOASC ! CONVERT IDENTIFIER TO ASCII HELD_DIVS_CTR = 0% ! INIT COUNT OF HELD DIVISIONS HELD_DBS_CTR = 0% ! INIT COUNT OF HELD DATABASES CONTEXT = 0% HOLDER(0%) = UIC HOLDER(1%) = 0% ! ----- NO NEED TO GET IDENTIFIERS IF PRIVILEGED USER ----- IF PRIVILEGED THEN ! ----- SET SO LOOP WILL BE SKIPPED ----- LOCAL_STATUS = SS$_NOSUCHID ELSE ! ----- SET SO LOOP WILL EXECUTE ONCE ----- LOCAL_STATUS = SS$_NORMAL END IF WHILE LOCAL_STATUS = SS$_NORMAL ! ----- LOCATE NEXT IDENTIFIER VALUE THAT IS HELD ----- ! ----- BY THIS USER ----- LOCAL_STATUS = SYS$FIND_HELD(HOLDER() BY REF, & ID, , CONTEXT) ITERATE IF LOCAL_STATUS = SS$_NOSUCHID IF LOCAL_STATUS <> SS$_NORMAL THEN PRINT "GET_HELD_IDENTIFIERS Error for" & + " SYS$FIND_HELD" CALL LIB$STOP(LOCAL_STATUS BY VALUE) END IF ! ----- TRANSLATE IDENTIFIER VALUE TO ASCII STRING ----- LOCAL_STATUS = SYS$IDTOASC(ID BY VALUE, & ID_NAME_LENGTH, ID_NAME, , , ) IF LOCAL_STATUS <> SS$_NORMAL THEN PRINT "GET_HELD_IDENTIFIERS Error" + & " for SYS$IDTOASC" CALL LIB$STOP(LOCAL_STATUS BY VALUE) END IF IF ID_NAME_LENGTH = 0% THEN LOCAL_STATUS = SS$_NOSUCHID PRINT "GET_HELD_IDENTIFIERS: No ID Length" CALL LIB$STOP(LOCAL_STATUS BY VALUE) END IF ! ----- SKIP IF NOT MASTER_div OR MASTER_nnn ----- ITERATE IF ID_NAME_LENGTH <> 10% ITERATE IF LEFT(ID_NAME, 7%) <> "MASTER_" ! ----- EXTRACT AND VALIDATE DIVISION CODE / ----- ! ----- DATABASE ----- MASTER_DIV = MID(ID_NAME, 8%, 3%) MASTER_INDEX = 0% RECORD_FOUND = FALSE WHILE MASTER_INDEX < DIVISION_CTR AND NOT RECORD_FOUND MASTER_INDEX = MASTER_INDEX + 1% IF DIVISION_NAMES(MASTER_INDEX) = MASTER_DIV THEN ! ----- INCR COUNT OF HELD ----- ! ----- DIVISIONS ----- HELD_DIVS_CTR = HELD_DIVS_CTR + 1% ! ----- STORE THIS HELD DIVISION ----- ! ----- CODE ----- HELD_DIVS(HELD_DIVS_CTR) = MASTER_DIV ! ----- SET TO EXIT LOOP ----- RECORD_FOUND = TRUE ! ----- EXIT LOOP IF ARRAY FILLED ----- LOCAL_STATUS = SS$_ABORT IF & HELD_DIVS_CTR = MAX_DIVS END IF NEXT ! ----- IF NOT A DIVISION, SEE IF A DATABASE ----- IF NOT RECORD_FOUND THEN IF NUMERIC(MASTER_DIV) THEN ! ----- INCR COUNT OF HELD ----- ! ----- DATABASES ----- HELD_DBS_CTR = HELD_DBS_CTR + 1% ! ----- STORE THIS HELD DATABASE ----- ! ----- NUMBER ----- HELD_DBS(HELD_DBS_CTR) = MASTER_DIV ! ----- SET TO EXIT LOOP ----- RECORD_FOUND = TRUE ! ----- EXIT LOOP IF ARRAY FILLED ----- LOCAL_STATUS = SS$_ABORT IF & HELD_DBS_CTR = MAX_DBS END IF END IF NEXT IF LOCAL_STATUS <> SS$_NOSUCHID THEN ! ----- TERMINATE RIGHTS DATABASE CONTEXT ----- LOCAL_STATUS = SYS$FINISH_RDB(CONTEXT) IF LOCAL_STATUS <> SS$_NORMAL THEN PRINT "GET_HELD_IDENTIFIERS Error for" & + " SYS$FINISH_RDB" CALL LIB$STOP(LOCAL_STATUS BY VALUE) END IF END IF END SUB