From: rice@ttd.teradyne.com
Subject: Re: Finding out the user name?
Organization: Teradyne Inc., Telecommunications Division
Date: Fri, 14 Aug 92 02:34:04 GMT

In article <1992Aug10.140940.25426@uxa.ecn.bgu.edu>, uucm000@uxa.ecn.bgu.edu (Tingli Pan) writes:
> Is there a way to convert a UIC number (in the form [grp,uic]) to its
> user name on the DCL level? I'm assuming that each uic has only one user
> name.
> 

I wrote a command file to do name/uic conversions some time back. Called by
a symbol, it uses the form 

$ who [uic]
$ who username

to do the translations. It will also do some other 'tricks' with uic
translation. I include it here for your use (or as an example of how
to use lexical functions to do what you wish). It's not very well commented,
but hope it helps.....

---------CUT HERE---------


$! "WHO" will find a numerical UIC for a user or all users.
$! NOTE that allusers requires a file listing usernames of all users.
$! "WHO" will translate a UIC in numerical [grp,mem] format to username
$! "WHO" will find all users in a UIC group using [grp,*] as an input
$! 
$! "WHO/OUTPUT=filename" will output result to a file.
$!
$! created by J. Rice  14-NOV-86
$!
$ IF P1 .EQS. "" THEN GOTO HELP
$ IF P1 .EQS. "*" THEN GOTO ALLUSERS
$ IF F$EXTR(0,1,P1) .EQS. "[" THEN GOTO UIC
$!
$ USER:
$ TST :== 'P1'
$ UUIC :== 'F$FAO("!%U",(F$IDENT(TST,"NAME_TO_NUMBER")))'
$ WRITE SYS$OUTPUT ""
$ WRITE SYS$OUTPUT "''TST'     ''UUIC'"
$ @cmd:uaf 'p1'
$ GOTO EXIT
$!
$ ALLUSERS:
$ ON CONTROL_Y THEN GOTO ENDIT
$ WRITE SYS$OUTPUT ""
$ OPEN/READ INFILE all_user.txt ! filename must be a list of all usernames.
$ READLOOP:
$ READ/END_OF_FILE=ENDIT INFILE WHO_NAME
$ TST :== 'f$extr(0,12,WHO_NAME)'
$ UUIC :== 'F$FAO("!%U",(F$IDENT(TST,"NAME_TO_NUMBER")))'
$ NNAME = F$FAO(" !#(#AS)",1,12,TST)
$ IF UUIC .NES. "[0,0]" THEN WRITE SYS$OUTPUT "''NNAME'       ''UUIC'"
$ GOTO READLOOP
$!
$ ENDIT:
$ CLOSE INFILE
$ GOTO EXIT
$!
$!
$ UIC:
$ SET MESSAGE/NOTEXT/NOFACIL/NOIDENT/NOSEVER
$ ON CONTROL_Y THEN GOTO EXIT
$ INP := 'P1'
$ KEY = F$LOC(",",INP)
$ GRP = F$EXTR(1,KEY - 1,INP)
$ END = F$LEN(INP)
$ MEM = F$EXTR(KEY + 1,END - (KEY + 2),INP)
$ IF MEM .EQS. "*" THEN GOTO ALLMEM
$ UIC_INT = (%O'MEM' + (%X10000 * %O'GRP'))
$ WHO_NAME  :== 'F$IDENT(UIC_INT,"NUMBER_TO_NAME")'
$ WRITE SYS$OUTPUT ""
$ WRITE SYS$OUTPUT "''INP'     ''WHO_NAME'"
$ GOTO EXIT
$!
$ ALLMEM:
$ MEM = 0
$ GOTO STARTIT
$!
$ LOOPIT:
$ MEM = MEM + 1
$ STARTIT:
$ ON WARNING THEN GOTO LOOPIT
$ UIC_INT = (%O'MEM' + (%X10000 * %O'GRP'))
$ WHO_NAME  := 'F$IDENT(UIC_INT,"NUMBER_TO_NAME")'
$ IF WHO_NAME .NES. "" THEN WRITE SYS$OUTPUT "[''GRP',''MEM']     ''WHO_NAME'"
$ ON WARNING THEN CONTINUE
$ IF MEM .NE. 377 THEN GOTO LOOPIT
$ GOTO EXIT
$!
$!
$ HELP:
$ WRITE SYS$OUTPUT " $ WHO username     returns        UIC in [grp,member] format "
$ WRITE SYS$OUTPUT " $ WHO *            returns        UIC's for all users"
$ WRITE SYS$OUTPUT " $ WHO [grp,mem]    returns        username for UIC"
$ WRITE SYS$OUTPUT " $ WHO [grp,*]      returns        all users for UIC group
$ WRITE SYS$OUTPUT " "
$!
$ EXIT:
$ SET MESSAGE/FACIL/SEVER/IDENT/TEXT
$!

------------------------CUT HERE ---END -------------------------------

   John Rice        K9IJ     |  "Did I say that ?" I must have, but It was
                             |   MY opinion only, no one else's...Especially
                             |   Not my Employer's....
   rice@ttd.teradyne.com     |   Purveyor of Miracles,Magic and Sleight-of-hand
Newsgroups: comp.os.vms,vmsnet.internals