z/OS Using REXX and z/OS UNIX System Services
Previous topic | Next topic | Contents | Contact z/OS | Library | PDF


Print the group member names

z/OS Using REXX and z/OS UNIX System Services
SA23-2283-00

This REXX program uses getgrgid, getgrgnam, and write to print the names of the users that are connected to a group. The group can be specified as either a GID or a group name.
/* rexx */
arg group .
address syscall
if datatype(group,'W')=1 then
   'getgrgid (group) gr.'   /* use getgrgid if GID specified          */
 else
   'getgrnam (group) gr.'   /* use getgrgnam if group name specified  */
if retval<=0 then           /* check for error                        */
   do
   say 'No information available for group' group
   return 1
   end
say 'Connected users for group' strip(gr.gr_name)'('gr.gr_gid')'
j=1
do i=gr_mem to gr.0
   buf='   ' gr.i
   if j//5=0 | i=gr.0 then
      buf=buf || esc_n      /* write newline every 5 groups or at end */
   j=j+1
   'write 1 buf'
end
return 0

Go to the previous page Go to the next page




Copyright IBM Corporation 1990, 2014