From:	MERC::"uunet!CRVAX.SRI.COM!RELAY-INFO-VAX" 22-JUN-1992 23:26:30.39
To:	info-vax@kl.sri.com
CC:	
Subj:	Re: Extracting Identifiers from RIGHTSLIST.DAT.

In article <98E4PSU@math.fu-berlin.de>, system@vaxser.grumed.fu-berlin.de (K.-H. Dittberner) writes:
>Hi VMS Gurus!

HI!

>Is there an easy (DCL-) way extracting all the
>identifiers from  SYS$SYSTEM:RIGHTSLIST.DAT
>held by a particular user ?    

You could do a SHOW PROCESS/PRIV/OUTPUT=filename.dat, then open the file
and peruse it for the identifier you are searching for.

>Or, is there another way getting an answer 
>(inside the SYLOGIN.COM) to the question 
>"Is identifier 'xyz' held by the current user ?"

But the suggestion above is sort of ugly to do in SYLOGIN (or anywhere
for that matter). I wrote a little FORTRAN program to do this a while ago. 
It's certainly not elegant (the method of passing the status back to DCL
could use a lot of improvment) but it does what you asked for, and it doesn't
require creating any files.

---------------------------- Cut here ---------------------------------
	program check_identifier
*
* This program checks to see whether the process running the program has
* a specified identifier assigned to it.
*
* Usage :
*
*   $ check_identifier :== $disk:[dir]check_identifier
*   $ check_identifier ident-name
*   $ if $status then (whatever)
*
* Written by : Bob Marshall
*              9 July 1990
*
**********************************************************
*
	implicit integer (A-Z)
*
	include '($jpidef)'
	include '($ssdef)'
*
	real*8 qid
	integer*4 id(2),context,jid
	character ident2check*32,this_id*32,username*12
	equivalence (qid,id)
	logical has_ident
*
	call lib$get_foreign(ident2check)
	if(ident2check .eq. ' ')call exit(2)  ! Error exit
*
* Get username of calling process
*
	call lib$getjpi(jpi$_username,,,,username,lu)
	call str$trim(username,username,lu)
*
* Convert username to quadword identifier
*
	id(2) = 0
	status = sys$asctoid(username(1:lu),id(1),)
*
	has_ident = .false.
*
* Loop through all identifiers held by this user, looking for the
* presence of the identifier
*
	status = sys$find_held(qid,jid,,context)
	context = 0
*
	do while((.not. has_ident) .and. 
     1            status .ne. ss$_nosuchid)
	  temp_context = 0
*
* Convert identifier to ASCII
*
	  call sys$idtoasc(%val(jid),jn,this_id,,,temp_context)
	  call str$trim(this_id,this_id,lt)
	  if(this_id(1:lt) .eq. ident2check)then
	    has_ident = .true.
	    call exit(1)     ! Successful exit
	  endif
*
* Get next held identifier
*
	  status = sys$find_held(qid,jid,,context)
*
	enddo
*
	call exit(2)         ! "Error" exit (does not have ident)
*
	end
=============================================================================
Bob Marshall                          ^ "If heaven ain't a lot like Dixie    
Lockheed Missiles & Space Co.        |L| I don't wanna go.  
Sunnyvale, CA                        |M| If they don't have a Grand Ole Opry
(408)756-5737                        |S| Like they do down in Tennessee
marshall@force.ssd.lmsc.lockheed.com |C| Just send me to hell, or New York City
                                     / \ It'd be about the same to me."  
=============================================================================

