Usenet comp.sys.dec (1990-2013)
 help / color / mirror / Atom feed
From: vandenheuvel@eps.enet.dec.com.no.spam (Hein RMS van den Heuvel)
Subject: Re: Next unused UIC program
Date: 1997/01/02	[thread overview]
Message-ID: <5ah1mg$hri$1@nntpd.lkg.dec.com> (raw)
In-Reply-To: 32C98B92.5723@dartmouth.edu



In article <32C98B92.5723@dartmouth.edu>, Richard Hammersley <hammersley@dartmouth.edu> writes...
>I'm looking for an example of a program that finds 
>the next unused available uic in a specified uic group.

Ha! That sounds like on easy VMS question (is it?) to get the new year going.
Being an RMS hacker, I am tempted to show you some (DCL) code to dive 
into F$PARSE("RIGHTSLIST","SYS$SYSTEM:.DAT") directly, but let's behave
and just stick to a nice easy brute force method...

Walking forward fm member 1 or a known bunch of members...

$ IF p1.eqs."" THEN INQUIRE p1 "Group (octal)"
$ IF p1.eqs."" THEN EXIT
$ grp = %o'p1' * 65536
$ mem = 1
$ IF p2.nes."" THEN mem = %o'p2'  ! Start at selected member number ?!
$loop:
$ IF F$IDENT (grp + mem, "NUMBER_TO_NAME") .EQS. "" THEN GOTO done
$ mem = mem + 1
$ IF mem .LT. 65535 THEN GOTO loop
$ WRITE SYS$OUPUT "No free UIC found in group ",p1
$ EXIT
$done:
$ SHOW SYMBOL mem


Or walking backwards from within a hole (best not done across full range !)

$ IF p1.eqs."" THEN INQUIRE p1 "Group (octal)"
$ IF p1.eqs."" THEN EXIT
$ grp = %o'p1' * 65536
$ mem = 65535 
$ IF p2.nes."" THEN mem = %o'p2'
$loop:
$ mem = mem - 1
$ IF F$IDENT (grp + mem, "NUMBER_TO_NAME") .NES. "" THEN GOTO done
$ IF mem .GT. 0 THEN GOTO loop
$ WRITE SYS$OUPUT "No free UIC found in group ",p1
$ EXIT
$done:
$ mem = mem + 1
$ SHOW SYMBOL mem

Hope this helps,		+--------------------------------------+
Hein van den Heuvel, Digital.	| All opinions expressed are mine, and |
  "Makers of VMS and other	| may not reflect those of my employer |
   fine Operating Systems."	+--------------------------------------+



  reply	other threads:[~1997-01-02  5:00 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1996-12-31  5:00 Next unused UIC program Richard Hammersley
1997-01-02  5:00 ` Hein RMS van den Heuvel [this message]
1997-01-02  5:00 ` Richard L. Johnson
read-only archive

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox