From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 1164f8,5fd950591a49ab67 X-Google-Attributes: gid1164f8,public From: vandenheuvel@eps.enet.dec.com.no.spam (Hein RMS van den Heuvel) Subject: Re: Next unused UIC program Date: 1997/01/02 Message-ID: <5ah1mg$hri$1@nntpd.lkg.dec.com>#1/1 X-Deja-AN: 207336864 references: <32C98B92.5723@dartmouth.edu> organization: Digital Equipment Corporation newsgroups: comp.sys.dec In article <32C98B92.5723@dartmouth.edu>, Richard Hammersley 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." +--------------------------------------+