Thanks for the assistance Bruce, you're a good man, gentleman and a
scholar.......
-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx [
mailto:rpg400-l-bounces@xxxxxxxxxxxx]
On Behalf Of Bruce Vining
Sent: Sunday, April 08, 2007 8:04 AM
To: RPG programming on the AS400 / iSeries
Subject: RE: API to display all users in USRPRF
Doug,
QSYRAUTU will get you started, but needs to be combined with QSYRUSRI. 
Below I've appended a sample program that should DSPLY all user profiles 
that match your definition of 'active'.  Assuming you have option 13 
(System Openness includes) of i5/OS installed you should be able to just 
CRTBNDRPG and then call the program.  Where you find the statement 'dsply 
QSYUP01;' is where any subfile loading logic would be applied. 
One little warning.  You may have your system setup to prevent this, but 
in general just getting a list of enabled non-group user profiles does not 
mean you have a list of all user profiles  that are active on your system. 
 There is nothing inherent to i5/OS which prevents someone from signing on 
using a group profile.  You may want to supplement this sample program 
with another that displays all group profiles which are enabled with a 
password specified.  This list of profiles, and the associated password 
information, can be found using the same APIs - QSYRAUTU and QSYRUSRI.
Hope this helps,
Bruce Vining
h dftactgrp(*no) 
 
d/copy qsysinc/qrpglesrc,qsyrautu 
d/copy qsysinc/qrpglesrc,qsyrusri 
d/copy qsysinc/qrpglesrc,qusec 
 
dGetUsrList       pr                  extpgm('QSYRAUTU') 
d Receiver                       1    options(*varsize) 
d LengthRcv                     10i 0 const 
d Feedback                            likeds(QSYUTUFI) 
d Format                         8    const 
d Criteria                      10    const 
d StrProfile                    10    const 
d StrPrfOpt                      1    const 
d GrpPrfName                    10    const 
d QUSEC                               likeds(QUSEC) 
d EndProfile                    10    const options(*nopass) 
 
dGetUsrInfo       pr                  extpgm('QSYRUSRI') 
d Receiver                       1    options(*varsize) 
d LengthRcv                     10i 0 const 
d Format                         8    const 
d ProfileName                   10    const 
d QUSEC                               likeds(QUSEC) 
 
dReceiver         ds                  likeds(QSYU0100) 
d                                     based(ListEntryPtr) 
 
dReceiverPtr      s               * 
dCount            s             10i 0 
dWait             s              1 
 
 /free 
 
  // Set error code to signal exceptions 
  QUSBPRV = 0; 
 
  // Get the size of receiver variable needed to get all user 
  // profiles that are not a group 
  GetUsrList( QSYU0100 :0 :QSYUTUFI :'AUTU0100' 
             :'*USER' :'*FIRST' :'1' :'*NONE' :QUSEC); 
 
 
  // Allocate the needed size 
  ReceiverPtr = %alloc(QSYBAVL03); 
 
  // Address where the first entry should be returned 
  ListEntryPtr = ReceiverPtr; 
 
  // Get the list of user profiles that are not in a group 
  GetUsrList( Receiver :QSYBAVL03 :QSYUTUFI :'AUTU0100' 
             :'*USER' :'*FIRST' :'1' :'*NONE' :QUSEC); 
 
  // Display the number of profiles returned 
  dsply (%char(QSYPNBR) + ' entries returned.'); 
 
  // Process each returned entry 
  for Count = 1 to QSYPNBR; 
 
      // Get user profile information 
      GetUsrInfo( QSYI0100 :%size(QSYI0100) :'USRI0100' 
                 :Receiver.QSYPN02 :QUSEC); 
 
      // If enabled display the user profile name 
      if QSYUS01 = '*ENABLED'; 
         dsply QSYUP01; 
      endif; 
 
      // Address the next returned entry 
      ListEntryPtr += QSYEL; 
  endfor; 
 
  // Show that we're done and exit 
  dsply 'End of List.' ' ' Wait; 
 
 dealloc ReceiverPtr; 
 *inlr = *on; 
  return; 
 
 /end-free 
 
"Doug Palme" <dpalme@xxxxxxxxxxx> 
Sent by: rpg400-l-bounces@xxxxxxxxxxxx
04/06/2007 01:34 PM
Please respond to
RPG programming on the AS400 / iSeries <rpg400-l@xxxxxxxxxxxx>
To
"'RPG programming on the AS400 / iSeries'" <rpg400-l@xxxxxxxxxxxx>
cc
Subject
RE: API to display all users in USRPRF
Profiles that are of the *USER class (so as to exclude groups) and that 
have
not been disabled.
I thought that QSYSRAUTU api might work but it appears (unless I am not
understanding the manual) it only shows those users who have *read access 
to
a specific object.
-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx [
mailto:rpg400-l-bounces@xxxxxxxxxxxx]
On Behalf Of Bruce Vining
Sent: Friday, April 06, 2007 1:32 PM
To: RPG programming on the AS400 / iSeries
Subject: Re: API to display all users in USRPRF
Can you define "active"?  I suspect that you will need to combine a few 
APIs to get the job done, but without knowing what you mean by active I 
can't be sure which APIs.
Bruce Vining
"Doug Palme" <dpalme@xxxxxxxxxxx> 
Sent by: rpg400-l-bounces@xxxxxxxxxxxx
04/06/2007 01:13 PM
Please respond to
RPG programming on the AS400 / iSeries <rpg400-l@xxxxxxxxxxxx>
To
"'RPG programming on the AS400 / iSeries'" <rpg400-l@xxxxxxxxxxxx>
cc
Subject
API to display all users in USRPRF
I asked something similar a while back and never really got an answer to
this question and the project at the time went away, well it has 
resurfaced
again.
 
I have a need to display all users that have an active profile on the 
system
in a subfile, we will be using this for other security issues unrelated to
the OS itself (application specific).
 
Is anyone aware of an API that will do this?
 
 
Douglas
 
****************************************************************************
This transmission may contain information that is privileged,
Confidential and/or exempt from disclosure under applicable law.
If you are not the intended recipient, you are hereby notified that
any disclosure, copying, distribution, or use of the information
contained herein (including any reliance thereon) is STRICTLY
PROHIBITED. If you received this transmission in error, please
immediately contact the sender and destroy the material in its
entirety, whether in electronic or hard copy format. Thank you.
****************************************************************************
As an Amazon Associate we earn from qualifying purchases.