Admin Alert: The Joys of Creating User Profile Information Files
April 7, 2004 Joe Hertvik
Inside an OS/400 partition, there are always questions about user profiles and how they are configured. These questions, including the last time user passwords were changed, which profiles have expired, and which users have which authorities, may require you to search through dozens of user profiles to get answers. I find it’s helpful to create and maintain a user profile information file for centralizing such information.
A user profile information file contains the complete set of user profile parameters that are defined for one profile, a subset of your OS/400 user profiles, or all of the iSeries or AS/400 user profiles in your shop. You create this file by redirecting the Display User Profile (DSPUSRPRF) command information into an output file. To create this file for all users on an OS/400 partition, for example, run the command with these parameters:
DSPUSRPRF USRPRF(*ALL) TYPE(*BASIC) OUTPUT(*OUTFILE) OUTFILE(LIB/FILENAME)
This command creates a complete file listing of all the parameters that are assigned to each user profile in your partition. Information about each user and group profile is contained inside individual records. This file can be used in OS/400 queries or can be downloaded into a database program, like Microsoft Access, or into a Microsoft Excel spreadsheet, for further processing. Here are just a few pieces of information that you can glean by working with this file:
- Which users are consuming the most storage on your system? (Sort the file by the Storage Used field, UPMXSU.)
- Which user profiles have been unused for the longest period of time? (Sort the file by the Previous Sign-On Date field, UPPSOD).
- Which user profiles are disabled? (Display all records that contain the word *DISABLED in the Status field, UPSTAT.)
- Which profiles have passwords that will never expire? (Look for records with a -1 in the Password Expiration Interval field, UPPWEI.)
And there’s a lot more information you can find by just opening the file inside a database program. Look at the file’s field layout, after you’ve created it, to determine what type of information you can retrieve.
But there are also a few tricks to keep in mind when creating your user profile information file. In particular, remember these three points:
- You can only send DSPUSRPRF information to an output file when you designate the type of information parameter (TYPE) as *BASIC. For most of the other DSPUSRPRF TYPE values–including user Device Authority (when the TYPE parameter equals *DEVAUT) and Object Authority (setting TYPE equal to *OBJAUT)–the information can only be displayed or printed; it cannot be captured to an output file.
- You can also create user profile information files that contain subsets of your OS/400 profiles or files that contain information for only one individual user profile. If all accounting user profiles start with the letters AC, for example, you could create a user profile information file with just those user IDs by entering the DSPUSRPRF command, like this:
- The DSPUSRPRF generated outfile is modeled on the QADSPUPB file in the QSYS library, and it uses the QSYDSUPB format inside that file. So if you wanted to open your user profile information file for more advanced processing inside a CL or an RPG program, code and compile your program using QADSPUPB and then override the QADSPUPB file at runtime, with the information file you created through the DSPUSRPRF command.
DSPUSRPRF USRPRF(AC*) TYPE(*BASIC) OUTPUT(*OUTFILE) OUTFILE(LIB/FILENAME)
For user profile subsets, use the common starting letters of each profile name you want to capture in the output file as a wildcard character (for example, AC for accounting).
Please participate in our iSeries programming survey at http://www.surveymonkey.com/s.asp?u=74193419903 |
If you wanted to dump the user profile information for just one user into a file, you would enter the command this way:
DSPUSRPRF USRPRF(USERIDNAME) TYPE(*BASIC) OUTPUT(*OUTFILE) OUTFILE(LIB/FILENAME)
Also be aware that creating a profile information file by using DSPUSRPRF this way will generate a completely new file each time it runs. This function is performed through the Output member options parameter (OUTMBR) of DSPUSRPRF, which is set to replace file records by default (OUTMBR equals *REPLACE). If you want to change the command so that it appends your new records to an existing file, run DSPUSRPRF this way with the second value of the OUTMBR parameter set to *ALL, like this:
DSPUSRPRF USRPRF(USERIDNAME) TYPE(*BASIC) OUTPUT(*OUTFILE) OUTFILE(LIB/FILENAME) OUTMBR(*FIRST *ADD)
As you see, there are many benefits to listing your user profile information inside a DSPUSRPRF output file. Try it yourself and see if it answers user profile questions in your shop.