List objects owned by named user in iSeries

2,555 pts.
Tags:
DSPOBJD
IBM
Object authority
System i
V6R1
How can I list all objects on a system owned by named user. (I am trying to track where a certain user has made changes in the past (years ago..), and I want this to be part of the analysis.

I would like to have a parameter 'OWNER' on the DSPOBJD command, but its not there.

System to be analysed is a 3TB system with many apps, and its running 24-7, so a total DSPOBJD to an outfile is NOT a valid solution in this case.

Any ideas on this will be most apreciated.

DanF

 

 





Software/Hardware used:
IBM System i (Power 6) V6R1
ASKED: December 14, 2010  7:53 AM
UPDATED: April 28, 2011  5:47 PM

Answer Wiki

Thanks. We'll let you know when a new response is added.

You could try the WRKOBJOWN command. The only parameter is the user profile. I would suggest submitting this command to batch.

Try this..

User profile . . . . . . . . . . > *ALL Name, generic*, *ALL
Type of information . . . . . . > *OBJOWN *BASIC, *ALL, *CMDAUT..
Output . . . . . . . . . . . . . > *OUTFILE *, *PRINT, *OUTFILE
File to receive output . . . . . usertemp Name
Library . . . . . . . . . . . XXXXXXX Name, *LIBL, *CURLIB
Output member options:
Member to receive output . . . *FIRST Name, *FIRST
Replace or add records . . . . *REPLACE *REPLACE, *ADD

U can save this information in outfile, and can use it accordingly

Discuss This Question: 19  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • DanTheDane
    Vervina, WRKOBJOWN does not run in batch (as far as I can read). Would be nice if the command had an *OUTFILE option and was allowed for batch processing. DanF
    2,555 pointsBadges:
    report
  • KasMcc
    I use the DSPUSRPRF command and ask for Owned objects. I then put the info to an output file which I can manipulate in query, etc User profile . . . . . . . . . . > *ALL Name, generic*, *ALL Type of information . . . . . . > *OBJOWN *BASIC, *ALL, *CMDAUT.. Output . . . . . . . . . . . . . > *OUTFILE *, *PRINT, *OUTFILE File to receive output . . . . . usertemp Name Library . . . . . . . . . . . XXXXXXX Name, *LIBL, *CURLIB Output member options: Member to receive output . . . *FIRST Name, *FIRST Replace or add records . . . . *REPLACE *REPLACE, *ADD
    230 pointsBadges:
    report
  • wpoulin
    Dan, I did something similar to KasMcc, here is part of my CL; PGM PARM(&USRPRF) DCLF FILE(QSYS/QADSPUPO) RCDFMT(QSYDSUPO) DCL VAR(&USRPRF) TYPE(*CHAR) LEN(10) DSPUSRPRF USRPRF(&USRPRF) TYPE(*OBJOWN) + OUTPUT(*OUTFILE) OUTFILE(QTEMP/QADSPUPO) OVRDBF FILE(QADSPUPO) TOFILE(QTEMP/QADSPUPO) + POSITION(*RRN 1) SHARE(*YES) Hope this helps, Bill Poulin
    2,480 pointsBadges:
    report
  • TomLiotta
    Assuming that you only care about /QSYS.LIB, DSPUSRPRF *OBJOWN is probably sufficient. If you really need to know a complete list of a user's owned objects, you'll need to use the List Objects User Is Authorized to, Owns, or Is Primary Group of (QSYLOBJA) API. You'll need to call the API twice (at least), once for format OBJA0100 and again for format OBJA0110. Tom
    125,585 pointsBadges:
    report
  • DanTheDane
    Try this.. User profile . . . . . . . . . . > *ALL Name, generic*, *ALL Type of information . . . . . . > *OBJOWN *BASIC, *ALL, *CMDAUT.. Output . . . . . . . . . . . . . > *OUTFILE *, *PRINT, *OUTFILE File to receive output . . . . . usertemp Name Library . . . . . . . . . . . XXXXXXX Name, *LIBL, *CURLIB Output member options: Member to receive output . . . *FIRST Name, *FIRST Replace or add records . . . . *REPLACE *REPLACE, *ADD U can save this information in outfile, and can use it accordingly
    0 pointsBadges:
    report
  • DanTheDane
    Ddaswani, Which command is it ?? DanF
    2,555 pointsBadges:
    report
  • Whatis23
    The same command listed by KasMcc, DSPUSRPRF. Press F4 to prompt then F9 for more parms.
    5,665 pointsBadges:
    report
  • TomLiotta
    Looks just like DSPUSRPRF to me. Tom
    125,585 pointsBadges:
    report
  • DanTheDane
    I tested the DSPUSRPRF:
    SBMJOB CMD(DSPUSRPRF USRPRF(userid)
              TYPE(*OBJOWN)
              OUTPUT(*OUTFILE)
              OUTFILE(mylib/userid))
    
    Worked fine and solved a big part of the problem. Remaining is the IFS. Since I need the proces of finding objects and files to execute as BATCH, I wonder if this can be solved by using some Qshell command (find, grep !! piped to file) initiated from a CL-pgm. Any thoughts (and example code..) on using QSH-commands are most welcome. DanF
    2,555 pointsBadges:
    report
  • wpoulin
    Dan, Did you come up with a solution to get the list of owned objects in the IFS ? I would be interested in the solution. Thanks, Bill Poulin
    2,480 pointsBadges:
    report
  • TomLiotta
    I have a basic ILE CL example that only retrieves the counts from the two calls of the API. To access the individual owned objects, the lists would need to be looped through. That's done the same way any user space list is processed, so almost any other code sample could mostly be copied. I originally created the example when I wanted to see what the API put into the user space, but I didn't need anything more from it. The actual code that I've used in production can't be supplied unfortunately, since it's not mine. The example accepts a user profile as a parm. It calls the API twice for the two separate lists, extracts the counts from the lists and then dumps its variables. I can answer questions about extending the example.
    pgm     ( +
              &pUsrPrf     +
            )
    
       dcl    &pUsrPrf         *char      10
    
    
       dcl    &UsrPrf          *char      10
    
       dcl    &UsrSpc          *char      10     value( 'LOBJOWN   ' )
    
       dcl    &qusrspc         *char      20
    
       dcl    &ErrCod          *char       4
       dcl    &hCont           *char      20
    
    
       dcl    &us_hdr          *char     150   /* Space header      */
       dcl    &l_hdr           *char      34   /* List header       */
    
    /* Loop checking...                                                 */
       dcl    &LoopChk         *dec       11     value( 0 )
    
    /* Total objects...                                                 */
       dcl    &tObjOwn         *dec       11     value( 0 )
       dcl    &tObjOwn2        *dec       11     value( 0 )
    
    
    /* General fields for RUSGENHDR...                                  */
       dcl    &nbrlste         *int
       dcl    &ists            *char       1
       dcl    &offshdr         *int
    
    
       chgvar            &UsrPrf                  &pUsrPrf
       chgvar            &hCont                   ' '
       chgvar            &qusrspc               ( &UsrSpc *cat 'QTEMP' )
    
       call    QUSCRTUS   ( +
                            &qusrspc                +
                            'TMPLST    '            +
                            x'00001000'             +
                            X'00'                   +
                            '*ALL      '            +
                            'Temp list obj owned    ' +
                            '*YES      '            +
                            x'0000000000000000'     +
                          )
    
    
    QFS_obj:
    
       dountil  ( &ists *ne 'P' )
    
          call    QSYLOBJA   ( +
                               &qusrspc                +
                               'OBJA0100'              +
                               &UsrPrf                 +
                               '*ALL      '            +
                               '*OBJOWN   '            +
                               &hCont                  +
                               x'0000000000000000'     +
                             )
    
    /*  Retrieve the initialization data...                             */
    
          call    QUSRTVUS   ( +
                               &qusrspc                +
                               x'00000001'             +
                               x'00000096'             +
                               &us_hdr                 +
                             )
    
          chgvar         &nbrlste           %bin( &us_hdr    133 4 )
          chgvar         &ists              %sst( &us_hdr    104 1 )
          chgvar         &offshdr           %bin( &us_hdr    117 4 )
    
          chgvar         &offshdr               ( &offshdr + 1 )
    
          call    QUSRTVUS   ( +
                               &qusrspc                +
                               &offshdr                +
                               x'00000022'             +
                               &l_hdr                  +
                             )
    
          chgvar         &hCont             %sst( &l_hdr  11  20 )
    
    dmpclpgm
    
          if  ( &nbrlste *eq 0 )     do
             sndpgmmsg  msgid( CPF9898 ) msgf( QCPFMSG ) +
                          msgdta( 'No objects listed' )
             leave
          enddo
    
    /* Add this count to our total...                            */
    
          chgvar         &tObjOwn               ( &tObjOwn  + &nbrlste )
          chgvar         &LoopChk               ( &LoopChk  + 1 )
    
       enddo
    
       chgvar        &hCont            ' '
    
    IFS_obj:
    
       dountil  ( &ists *ne 'P' )
    
          call    QSYLOBJA   ( +
                               &qusrspc                +
                               'OBJA0110'              +
                               &UsrPrf                 +
                               '*ALL      '            +
                               '*OBJOWN   '            +
                               &hCont                  +
                               x'0000000000000000'     +
                             )
    
    /*  Retrieve the initialization data...                             */
    
          call    QUSRTVUS   ( +
                               &qusrspc                +
                               x'00000001'             +
                               x'00000096'             +
                               &us_hdr                 +
                             )
    
          chgvar         &nbrlste           %bin( &us_hdr    133 4 )
          chgvar         &ists              %sst( &us_hdr    104 1 )
    
    
          if  ( &nbrlste *eq 0 )     do
             sndpgmmsg  msgid( CPF9898 ) msgf( QCPFMSG ) +
                          msgdta( 'No IFS objects listed' )
             leave
          enddo
    
    /* Add this count to our total...                            */
    
          chgvar         &tObjOwn2              ( &tObjOwn2 + &nbrlste )
          chgvar         &LoopChk               ( &LoopChk  + 1 )
    
       enddo
    
    
    Clean_up:
    
       dltusrspc   QTEMP/&UsrSpc
    dmpclpgm
    
       return
    
    endpgm
    It should compile and run on any V5R3 or later system. Tom
    125,585 pointsBadges:
    report
  • TomLiotta
    BTW, as usual, pay attention to the quote marks. Many of them need to be transformed after this editor is done with them. Tom
    125,585 pointsBadges:
    report
  • DanTheDane
    After a lot of searching, reading and experimenting, I believe that I am now very close to a solution. The essence of it is this: I first created a PF to contain found 'objects' (filename MYFILE). then use qshell's 'find' , and the result of this is piped to myfile.mbr.
    CRTPF QRPLOBJ/MYFILE  RCDLEN(200)
    SBMJOB CMD(STRQSH CMD('find / -type f -user userid  > 
                           /qsys.lib/qrplobj.lib/myfile.file/myfile.mbr'))
    
    This seems to satisfy my need for a batch-processed solution, BUT...... my 'small-scale' test-results does not always compare to the result of the interactive WRKOBJOWN command., and that puzzles me. For one test-user the result showed both elements from IFS and objects rom libraries presented as 'qsys.lib/mylib.lib....'. For another test-user I only got the elemnts from IFS, and NOT this users owned objects in libraries. I wonder if the cause for this is related to some security issue.. I currently try to work out sample tests to understand this behaviour. Any thoughts on this is most velcome. DanF
    2,555 pointsBadges:
    report
  • TomLiotta
    I don't think you can rely on -type f to help. Actually, I'd expect that no type can give you what you're trying for. You might need to try not specifying any type and then excluding everything you don't want when you process the outfile. Remember, a database file is an example of something that doesn't match -type f, although each member will. Source files tend to give a lot of "files". Tom
    125,585 pointsBadges:
    report
  • TomLiotta
    Also, when using "/" as the starting directory, be careful with /QNTC and possibly others. Tom
    125,585 pointsBadges:
    report
  • DanTheDane
    Tom, you are right :-) The -type f shall not be included. My current solution is therefore this:
    STRQSH CMD('find /   -user userid >           
     /qsys.lib/mylib.lib/myfile.file/myfile.mbr') 
    
    I would like to include an option to omit , so fx /QNTC was not searched. I do not yet know if this can be acomplished... This IBM manual on Qshell (page 62) http://publib.boulder.ibm.com/iseries/v5r1/ic2924/info/rzahz/rzahz.pdf describes the options for the find command, and I am especially looking into the [expression] part to solve my requirementfor omissions. Comments on this are welcome. DanF
    2,555 pointsBadges:
    report
  • TomLiotta
    Under Qshell find Operators is this statement -- "The primaries may be combined using the following operators." I haven't tried it, but I'd look into the !expression operator, possibly combined with the expression -and expression. You might try "-user uname -and !-path /QNTC/*" or some more involved construct. I'm not sure what Qshell find will need to process everything in i5/OS terms rather than Unix terms. The API will work better though. It's really not too bad to extend the example. Tom
    125,585 pointsBadges:
    report
  • DanTheDane
    [...] 5. One member is wondering how to change the IP authentication settings in his network’s firewall. 6. Check out all of the helpful answers on DanTheDane’s inquiry about listing objects owned by name user in iSeries. [...]
    0 pointsBadges:
    report
  • Pobretommy
    Try this: DSPOBJD OBJ(targetlib/*ALL) OBJTYPE(*ALL) OUTPUT(*OUTFILE) OUTFILE(userlib/outfile) Then query outfile: SELECT * FROM userlib/outfile WHERE ODCRTU = 'userid'
    10 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following