How can I list users whose status is disabled on AS/400 ?

15 pts.
AS/400 programming
AS/400 Reports
AS/400 user profiles
CL Program
Hello everybody ! I have to make a cl program in order to list users whose status is disabled. I wanted to know if someone had  tips for me. Thanks

Software/Hardware used:

Answer Wiki

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

If you have the proper authority, you can DSPUSRPRF *ALL Output(*OUTFILE)
Then do a Query or SQL of the file that was produced.
Query based on user profile status, like UPSTAT = ‘*DISABLED’

Discuss This Question: 3  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.
  • Kilizan
    Thanks a lot, I'll try tomorow
    15 pointsBadges:
  • TomLiotta
    I'm not sure what kinds of tips you need. This is a pretty straightforward process. Here's a trivial sample CL program that prints such a list:
    /* +
       CRTCLMOD MODULE( mylib/LSTUSRDSE )            +
                SRCFILE( mylib/QCLSRC )              +
                SRCMBR( LSTUSRDSE )                  +
                LOG( *NO )                           +
       CRTPGM PGM( mylib/LSTUSRDSE )                 +
              BNDDIR( QC2LE )                        +
              ACTGRP( *NEW )                         +
              USRPRF( *OWNER )                       +
    pgm  ( +
       dcl   &msgdta      *char  128
       dcl   &NL          *char    1     value( x'15' )
       dcl   &x00         *char    1     value( x'00' )
       dcl   &rc          *int
       dcl   &eofUSRDSE   *lgl           value( '0' )
    /* Compile over the IBM-supplied model file... */
       dclf  QADSPUPB
    /* List user profiles to a temporary file... */
       dspusrprf   *ALL  output( *OUTFILE ) outfile( QTEMP/LSTUSRDSE )
    /* ...and point the compiled file to our temporary one... */
       ovrdbf      QADSPUPB  tofile( QTEMP/LSTUSRDSE )
    /* Set a trivial page heading... */
       chgvar           &msgdta       ( +
                                        'List Disabled Profiles' *cat  +
                                        &NL          *cat  +
                                        &NL          *cat  +
                                        &x00               +
    /* Assign our printed output to QPRINT... */
       ovrdbf      STDOUT  +
                     tofile( QPRINT )  +
                     ovrscope( *JOB ) +
                     share( *YES )
    /* Print our trivial heading... */
       callprc        'printf'            ( +
                                            &msgdta        +
                                          ) +
                                    rtnval( &rc )
    /* Now loop through our temporary file until EOF... */
       dountil  ( &eofUSRDSE )
          monmsg ( cpf0864 )  exec( do )
             chgvar &eofUSRDSE   '1'
       /* If this one is '*DISABLED', print a line... */
          if ( &UPSTAT *eq '*DISABLED' )  do
             chgvar     &msgdta       ( +
                                        &UPUPRF      *cat  +
                                        '  '         *cat  +
                                        &UPTEXT      *cat  +
                                        &NL          *cat  +
                                        &x00               +
             callprc  'printf'            ( +
                                            &msgdta        +
                                          ) +
                                    rtnval( &rc )
    /* Clear away our override... */
       dltovr      STDOUT  lvl( *JOB )
    /* ...and get out of here... */
    One specific thing to beware of is that this editor kind of trashes single- and double-quote marks under various circumstances. If you put this into a source member, look it over carefully to catch where single-quotes need to be manually typed over. If the printed report is longer than a single page, you might consider adding a "page-heading" subroutine. You can compile the module and create the program in any library you wish. Just be sure to use the example CRTCLMOD and CRTPGM parameters at the least. You can add additional parms, but you'll have to debug oddities that will arise if you want to remove any from the minimum suggested parms. Tom
    125,585 pointsBadges:
  • The Most-Watched IT Questions: May 24, 2011 - ITKE Community Blog
    [...] 3. Deepu9321, CharlieBrowne, and TomLiotta came together with some tips for listing users whose status is disabled on AS/400. [...]
    0 pointsBadges:

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.

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


Share this item with your network: