From:	SMTP%"RELAY-INFO-VAX@CRVAX.SRI.COM"  7-AUG-1993 11:48:07.22
To:	EVERHART
CC:	
Subj:	Re: DCL - get next UIC member # routine

From: massey@travis.llnl.gov (Warren N. Massey)
X-Newsgroups: comp.os.vms
Subject: Re: DCL - get next UIC member # routine
Date: 4 Aug 93 14:51:38 -0800
Organization: Lawrence Livermore National Laboratory
Lines: 85
Message-Id: <1993Aug4.145138.1@travis.llnl.gov>
Nntp-Posting-Host: travis.llnl.gov
To: Info-VAX@kl.sri.com
X-Gateway-Source-Info: USENET

In article <01H1BCM68QHK95MWBZ@PUCAL.BITNET>, WHITEPR%PUCAL.BITNET@UICVM.UIC.EDU writes:
> No, we don't have a DCL routine that gets the next available UIC member for
> a UIC group.  We have a FORTRAN module that does just that, but it's based
> upon databases.  If still interested, contact me off the list.
> 

We too use a fortran routine that's based on the rights list. The DCL to 
interface with the fortran program uses two symbols to pass information:
	"group_number" is input for the program
	"member_number" is set by the program

The DCL look like this:

$get_uic:
$ write sys$output ""
$ inquire grp "UIC Group number (enter ? to list all UIC's) [''defgrp']"
$ if grp .eqs. "?" then Goto display_UIC_list
$ if grp .eqs. "" then grp = defgrp
$ defgrp = grp
$get_member:
$ group_number = defgrp
$ run sys$manager:next_free_uic
$ defmem = member_number
$ inquire uic -
  "UIC Member number (enter ? to list UIC ''defgrp' members) [''defmem']"
$ if uic .eqs. "?" then Goto display_UIC_members
$ write sys$output ""
$ if (uic .eqs. "") .and. (defmem .eqs. "") then Goto get_member
$ if uic .eqs. "" then uic = defmem
$ defmem = uic


The Fortran looks like this:

	PROGRAM NEXT_FREE_UIC
	CHARACTER*6 Member_String, Group_String
	INTEGER Current_UIC
	INTEGER Member, Last_Member, Current_Member
	INTEGER Group, Current_Group
	INTEGER KEYNUM

	OPEN(UNIT=1,FILE='SYS$SYSTEM:RIGHTSLIST.DAT',SHARED,READONLY,
	1	ACCESS='KEYED',STATUS='OLD',FORM='UNFORMATTED')
	Istat = Lib$Get_Symbol('GROUP_NUMBER', Group_String )

	IF( Istat .NE. 1 ) Then
	   TYPE 10
10	   FORMAT(' GROUP: ',$)
	   READ 20, GROUP
20	   FORMAT(BN,O6)
	Else
	   Read( Group_String, 20 ) Group
	End If

	KEYNUM = GROUP * '10000'X
	READ(1,KEYGE=KEYNUM,KEYID=0,ERR=900) Current_UIC
30	   Current_Group = Current_UIC / '10000'X
	   IF( Current_Group .NE. GROUP ) GOTO 900
	   Current_MEMBER = IAND(Current_UIC,'FFFF'X)
	   IF( Current_MEMBER .EQ. 'FFFF'X ) GOTO 900
	   IF( Current_MEMBER .GT. Last_Member+1 ) GOTO 900
	   Last_Member = Current_Member
	   READ(1,ERR=900) Current_UIC
	   GOTO 30
900	Member = Last_Member + 1
	IF( Member .EQ. 'FFFF'X ) GOTO 950
	IF( Istat .NE. 1 ) Then
	   TYPE 910, Group, Member
910	   FORMAT(' THE NEXT AVAILABLE UIC IN THE GROUP IS [',O6.6,',',O6.6,']')
	END IF
	WRITE(Member_String,920) Member
920	FORMAT(O6.6)
	CALL LIB$SET_SYMBOL('MEMBER_NUMBER', Member_String)
	GOTO 999
950	TYPE 960, GROUP
960	FORMAT(' GROUP', O6.6, ' IS FULL')
999	END



-- 

Warren N. Massey                                      Massey@Travis.LLNL.Gov
Lawrence Livermore National Laboratory   7000 East Ave., P.O. Box 808, L-495
Livermore, Calif. 94550  <<<My opinions are mine alone>>>      (510)422-1958

