Solved

Delete user profile automatically

Posted on 2001-06-20
7
528 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
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

This article shows the steps required to install WordPress on Azure. Web Apps, Mobile Apps, API Apps, or Functions, in Azure all these run in an App Service plan. WordPress is no exception and requires an App Service Plan and Database to install
No single Antivirus application (despite claims by manufacturers) will catch or protect you from all Virus / Malware or Spyware threats. That doesn't stop you from further protecting yourself however - and this article is to show you how.
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

679 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