Solved

Delete user profile automatically

Posted on 2001-06-20
7
521 Views
Last Modified: 2007-11-27
Users on our system are spread around the world, people are terminated or quit without us knowing about it. We have a policy to delete any user profiles with no activity for 6 months.

Is it possible to do this with in a CL program or something? I want to automate the process.
0
Comment
Question by:roosterup
  • 4
  • 2
7 Comments
 
LVL 16

Expert Comment

by:theo kouwenhoven
ID: 6213495
Hi roosterup,

We have did it already some time ago, but I'm not alowed to give you the source (company policy?).
But it works this way:
Create a CL-Program that will look like this:

Create a file with:
DSPUSRPRF USRPRF(*ALL)
          TYPE(*BASIC)
          OUTPUT(*OUTFILE)
          OUTFILE(library/file)
          OUTMBR(*FIRST *REPLACE)

use RCVF to read the records.
use the field UPPSOD to select the last logon date.
(exclude the standard users as QSECOFR QUSER etc. and also the users that are used for other jobs as FTPUSR etc.)

The selected user can be removed with:
DLTUSRPRF USRPRF(USER)          
          OWNOBJOPT(*CHGOWN new-owner)

The new owner can be a special created owner for this purpose or a standard user as QUSER.

Beware that you don't remove 'group profiles that are still in use'

Good lock.
0
 
LVL 13

Expert Comment

by:samic400
ID: 6213828
murphey2 has the idea.

I'd be glad to put together some quick source code if you need it.

put this program in the IBM job schedule (or other job scheduler - Robot) and have it run automatically each month.
0
 
LVL 1

Author Comment

by:roosterup
ID: 6214217
samic400

that would be kewl, must increase points for that.
0
Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

 
LVL 16

Expert Comment

by:theo kouwenhoven
ID: 6214358
(additional information)

Beware: new userid's have a blank date, in that case you can use the field UPPWCD or even better!!!
Use in that case the creation date from the USRPRF-object

 RTVOBJD OBJ(userid)
         OBJTYPE(*USRPRF)
         CRTDATE(&DATE)    

(and don't forget to calculate the century fields)

UPPSOC for the Sign-on date
  and
UPPWCC for the password change date.

The creation date of the object is including the century (and time) in format CYYMMDDHHMMSS.

Regards Murphey
0
 
LVL 16

Expert Comment

by:theo kouwenhoven
ID: 6214401
(addition 2)

To make no exceptions (makes the programming a lot easyer)

you can always retrieve the object description and use the last-used date to decide if the userprofile has to be deleted.
In that case use:
                         
RTVOBJD OBJ(userid)
        OBJTYPE(*USRPRF)
        CRTDATE(&CRTDAT)
        USEDATE(&USEDAT)

format:
(CRTDATE CYYMMDDHHMMSS)
(USEDATE CYYMMDD)
0
 
LVL 13

Accepted Solution

by:
samic400 earned 200 total points
ID: 6215602
       pgm
        dcl &diff *dec (3 0)
        dclf file(lib/file)

        dspusrprf usrprf(*all) output(*outfile)   outfile (lib/file)

 read:  rcvf
        monmsg cpf0864  exec(goto end)
       
     /* you'll need code here to:   */
     /*   1 - weed out profile you wish to exclude - */
     /*       mostly all start with Q                */
     /*   2 - code to check for UPPSOD date being blank */
     /*       which means it hasn't been used - murphey2*/
     /*       had right idea about RTVOBJD cmd          */
     /*   3 - if date found, I'd convert to some sort of*/
     /*       julian date to see if not used in over 6  */
     /*       many ways to do this                   */

     if (&diff *gt 180) then(do)
     dltusrprf  usrprf(&UPUPRF) ownobjopt(*chgown quser)
     monmsg cpf0000 exec(do)  /* in case cannot do it */
     /* may want to send a message to someone with */
     /* reason why cannot delete - rcvmsg to get the */
     /* details is the way I'd do it                */
     enddo

     enddo

     goto read

 end: endpgm

I recommend you compile under QSECOFR and that the file in DCLF statement exists. That way not playing games with using OVRDBF with IBM files.                                                                      
0
 
LVL 16

Expert Comment

by:theo kouwenhoven
ID: 6216021
Hey... my idea and no points ????
0

Featured Post

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
RPG to c# 3 358
as400 calendar 2 167
Find Date Difference in AS400 Query 11 472
vmware on IBM X3960 with HA - Idiots Guide 8 116
An article on effective troubleshooting
Knowing where your website is hosted is as important as the features you receive, the monthly fee, and the support you receive. Due diligence should be done when choosing your next hosting provider.
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
In a recent question (https://www.experts-exchange.com/questions/28997919/Pagination-in-Adobe-Acrobat.html) here at Experts Exchange, a member asked how to add page numbers to a PDF file using Adobe Acrobat XI Pro. This short video Micro Tutorial sh…

775 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question