Solved

Delete user profile automatically

Posted on 2001-06-20
7
506 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
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Run QShell commands from a bash shell 5 1,169
Remote Access to Bosanova Thin Client 1 337
AS400 Forms 9 98
iSeries DB2 - Query with Sub Query? 7 98
Short answer to this question: there is no effective WiFi manager in iOS devices as seen in Windows WiFi or Macbook OSx WiFi management, but this article will try and provide some amicable solutions to better suite your needs.
In  today’s increasingly digital world, managed service providers (MSPs) fight for their customers’ attention, looking for ways to make them stay and purchase more services. One way to encourage that behavior is to develop a dependable brand of prod…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

760 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now