* Next unused UIC program
@ 1996-12-31 5:00 Richard Hammersley
1997-01-02 5:00 ` Richard L. Johnson
1997-01-02 5:00 ` Hein RMS van den Heuvel
0 siblings, 2 replies; 3+ messages in thread
From: Richard Hammersley @ 1996-12-31 5:00 UTC (permalink / raw)
I'm looking for an example of a program that finds
the next unused available uic in a specified uic group.
Anyone know of a program on any of the DECUS or Digital
freeware CD or anywhere else that such code may be ?
Or a code fragment example ?
Thanks in advance.
Richard Hammersley
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Next unused UIC program
1996-12-31 5:00 Next unused UIC program Richard Hammersley
1997-01-02 5:00 ` Richard L. Johnson
@ 1997-01-02 5:00 ` Hein RMS van den Heuvel
1 sibling, 0 replies; 3+ messages in thread
From: Hein RMS van den Heuvel @ 1997-01-02 5:00 UTC (permalink / raw)
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." +--------------------------------------+
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Next unused UIC program
1996-12-31 5:00 Next unused UIC program Richard Hammersley
@ 1997-01-02 5:00 ` Richard L. Johnson
1997-01-02 5:00 ` Hein RMS van den Heuvel
1 sibling, 0 replies; 3+ messages in thread
From: Richard L. Johnson @ 1997-01-02 5:00 UTC (permalink / raw)
To: Richard Hammersley
[-- Attachment #1: Type: text/plain, Size: 1641 bytes --]
Richard Hammersley wrote:
>
> I'm looking for an example of a program that finds
> the next unused available uic in a specified uic group.
>
The following code fragment contains what you want. I pulled it from
our "adduser" program. I don't know if this code came from an existing
program or if we wrote it ourselves long ago. Good luck.
--------------------------------------------------------------
Rick Johnson |
The Aerospace Corporation | "I thought, therefore I
was"
email: johnson@halley.aero.org |
phone: (310)336-3588 | - Descartes...now
--------------------------------------------------------------
$! The following will ask the user to input a group number. The program
will
$! print out accounts in that group, report the first available UIC, and
allow
$! the user to input the uic desired.
$!
$uaf = "$authorize"
$inquire grp "UIC Group Number"
$if grp .eqs. "" then grp = "*"
$write sys$output ""
$write sys$output "Determine the UIC from the following listing:"
$write sys$output ""
$on warning then continue
$uaf show ['grp',*]/brief
$on warning then goto cleanup
$write sys$output ""
$!
$ grpnum = f$integer("%O''grp'")
$ mem=0
$ getuic:
$ mem=mem+1
$ nextuic=%X10000*grpnum+mem
$ if f$identifier(nextuic,"NUMBER_TO_NAME") .nes. "" then goto getuic
$ uicstr = f$fao("!%U", nextuic)
$!
$inquire uic "Enter full UIC in octal (DEFAULT:''uicstr'): "
$if uic .eqs. "" then uic="''uicstr'"
$if f$locate("[",uic) .eq. f$length(uic) .and. -
f$locate("<",uic) .eq. f$length(uic) then uic = "["+uic+"]"
[-- Attachment #2: NEXTUIC.COM.3 --]
[-- Type: text/plain, Size: 952 bytes --]
$! The following will ask the user to input a group number. The program will
$! print out accounts in that group, report the first available UIC, and allow
$! the user to input the uic desired.
$!
$uaf = "$authorize"
$inquire grp "UIC Group Number"
$if grp .eqs. "" then grp = "*"
$write sys$output ""
$write sys$output "Determine the UIC from the following listing:"
$write sys$output ""
$on warning then continue
$uaf show ['grp',*]/brief
$on warning then goto cleanup
$write sys$output ""
$!
$ grpnum = f$integer("%O''grp'")
$ mem=0
$ getuic:
$ mem=mem+1
$ nextuic=%X10000*grpnum+mem
$ if f$identifier(nextuic,"NUMBER_TO_NAME") .nes. "" then goto getuic
$ uicstr = f$fao("!%U", nextuic)
$!
$inquire uic "Enter full UIC in octal (DEFAULT:''uicstr'): "
$if uic .eqs. "" then uic="''uicstr'"
$if f$locate("[",uic) .eq. f$length(uic) .and. -
f$locate("<",uic) .eq. f$length(uic) then uic = "["+uic+"]"
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~1997-01-02 5:00 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1996-12-31 5:00 Next unused UIC program Richard Hammersley
1997-01-02 5:00 ` Richard L. Johnson
1997-01-02 5:00 ` Hein RMS van den Heuvel
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox