  UIC associated with Username? 
 The Question is:
 
 
   I need a system call that will return the UIC group if I pass it the
 username.    I know how to use GETJPI to get the UIC for the current process,
 but I don't know how to get this from the username.
 
 The Answer is :
 
  The OpenVMS system service SYS$GETUAI permits you to translate an
  arbitrary username to its associated UIC value.  This system service
  can (and very often does) require SYSPRV, GRPPRV, or another powerful
  privilege.
 
  For details on UIC and username specifications, please see the
  System Security Manual.  For details on programming with SYS$GETUAI
  and other system services, please see the System Service Reference
  Manual and the Programming Concepts Manual.
 
  The following is an example of working with the SYS$GETUAI service:
 
#include &lt;descrip.h&gt;
#include &lt;ssdef.h&gt;
#include &lt;starlet.h&gt;
#include &lt;stdio.h&gt;
#include &lt;stsdef.h&gt;
#include &lt;uaidef.h&gt;
#include &lt;unixlib.h&gt;
 
#define MAXACCLEN 16
 
struct ItemList3
    {
    short int ItemLength;
    short int ItemCode;
    void *ItemBuffer;
    void *ItemRetLen;
    };
 
main()
    {
    int RetStat;
#define MAXIL 5
    struct ItemList3 ItmLst[MAXIL];
    $DESCRIPTOR( UsernameDsc, "SYSTEM" );
    char Account[MAXACCLEN];
    int i;
 
    i = 0;
    ItmLst[i].ItemLength    = MAXACCLEN;
    ItmLst[i].ItemCode	    = UAI$_ACCOUNT;
    ItmLst[i].ItemBuffer    = (void *) Account;
    ItmLst[i++].ItemRetLen  = NULL;
    ItmLst[i].ItemLength    = 0;
    ItmLst[i].ItemCode	    = 0;
    ItmLst[i].ItemBuffer    = NULL;
    ItmLst[i++].ItemRetLen  = NULL;
 
    RetStat = sys$getuai( 0, 0, &amp;UsernameDsc, ItmLst, 0, 0, 0);
    if (!$VMS_STATUS_SUCCESS( RetStat ))
	return RetStat;
 
    return SS$_NORMAL;
    }
 
 
  There also exists a Compaq C run-time library (RTL) function called
  getpwnam(), and this call provides C programmers with a standard
  interface into the SYS$GETUAI interface.  For example:
 
 
#include &lt;pwd.h&gt;
#include &lt;stdio.h&gt;
#include &lt;stdlib.h&gt;
 
main()
  {
  struct passwd *p;
 
  if ( !(p = getpwnam(getenv("USER"))) )
    {
    perror("getpwnam");
    }
  else
    {
    printf("uid = %o\n", p-&gt;pw_uid);
    printf("gid = %o\n", p-&gt;pw_gid);
    printf("home directory = %s\n", p-&gt;pw_dir);
    printf("initial shell = %s\n", p-&gt;pw_shell);
    }
 
  return EXIT_SUCCESS;
  }
 
 
 Answer written or last revised on  30-OCT-2001 
