IBM i User Information is easy with SQL USER_INFO

  • Home
  • /
  • Blog
  • /
  • IBM i User Information is easy with SQL USER_INFO

March 17, 2024

IBM i User Information is easy with SQL USER_INFO

If you’re working with IBM i and need to retrieve information about user profiles, you can use the USER_INFO view. This view provides details about various aspects of user profiles.

Here are some key columns from the USER_INFO view:

  1. AUTHORIZATION_NAME: The user profile name.
  2. PREVIOUS_SIGNON: The date and time the user last signed on (or null if the profile has never been used for sign-on).
  3. SIGN_ON_ATTEMPTS_NOT_VALID: The number of invalid sign-on attempts since the last successful sign-on.
  4. STATUS: The status of the user profile (either DISABLED or ENABLED).
  5. NETSERVER_DISABLED: Indicates whether the user profile is disabled for IBM i NetServer use (YES or NO).
  6. PASSWORD_CHANGE_DATE: The date the user’s password was last changed.
  7. NO_PASSWORD_INDICATOR: Indicates whether the password in the user profile is set to NONE.
  8. PASSWORD_LEVEL_0_1: Indicates whether the user profile has a password that can be used for a system at QPWDLVL 0 or 1.
  9. PASSWORD_LEVEL_2_3: Indicates whether the user profile has a password that can be used for a system at QPWDLVL 2 or 3.
  10. PASSWORD_EXPIRATION_INTERVAL: The number of days the user’s password can remain active before it must be changed.
  11. DATE_PASSWORD_EXPIRES: The date the user’s password expires (null if the password won’t expire).
  12. DAYS_UNTIL_PASSWORD_EXPIRES: The number of days until the password expires (null if it won’t expire within the warning period).
  13. SET_PASSWORD_TO_EXPIRE: Indicates whether the user’s password is set to expire (YES or NO).
  14. USER_CLASS_NAME: The user’s class name (e.g., PGMR, SECADM, or SECOFR)Âą.

You can query this view using SQL to retrieve the desired information.

Read user_info to get IBM i Profile Information Easily

One of my clients recently asked me to create a spreadsheet of users with passwords that will expire within 30 days.

We can do this easily using SQL to pull the information.

Let’s write a SQL statement that says: “show me all users information for users where the expiry date is set to hit within the next 30 days. Show me all results in user profile alphabetic sequence.”

In SQL it’s easy, and it looks like this:

select *
    from qsys2.user_info
    where pwdexpdat between current date and current date + 30 days
    order by user_name

Here it is in IBM i ACS, showing a single result for a test user profile (un-imaginatively called TEST) which I created with a password set to expire in a few days:

IBM i User Information is easy with SQL USER_INFO

Now, you can easily download this as a spreadsheet by clicking the little download button in the bottom right corner.

Which made me think “How can we automate this to run weekly… and email the results automatically?”

Next blog, to answer that question:

NickLitten


IBM i Software Developer, Digital Dad, AS400 Anarchist, RPG Modernizer, Shameless Trekkie, Belligerent Nerd, Englishman Abroad and Passionate Eater of Cheese and Biscuits.

Nick Litten Dot Com is a mixture of blog posts that can be sometimes serious, frequently playful and probably down-right pointless all in the space of a day.

Enjoy your stay, feel free to comment and remember: If at first you don't succeed then skydiving probably isn't a hobby you should look into.

Nick Litten

related posts:

  • To download to Excel:
    – Enable Save Results
    – run the SQL statement
    – right-click the data and select Save Results

    The down-arrow you are referring to is to retrieve all of the data instead of just the first 100 rows.

  • {"email":"Email address invalid","url":"Website address invalid","required":"Required field missing"}

    Subscribe NOW
    7-day free trial

    Take This Course with ALL ACCESS

    Unlock your Learning Potential with instant access to every course and all new courses as they are released.
     [ For Serious Software Developers only ]

    IBM i Training For Technology Experts

    New!

    Successfully Work Remote 

     $ 129.00  $59.00

    By adding new skills in information technology, employers will be confident that you have the necessary skills and tools needed to successfully work remotely

    >