On a weekly basis I clean up all messages located in library QUSRSYS and QSYS.
To obtain a listing of all message queues, use the following: WRKOBJPDM QUSRSYS *ALL *MSGQ
You can then create a User-Defined Option by pressing the F16 key and then the F6 key. This will bring you to the Create User-Defined Option screen.
Here you need to add a two-letter code that hasn't been already assigned. (I like to use ZZ.) At the command parameter you will want to put CLRMSGQ &N and hit enter. Once you do that, you won't have to do that process again. Now all you need to do is make sure you are back at the WRKOBJPDM QUSRSYS *ALL *MSGQ screen. There you type ZZ at the option line. Next hit the F13 key to repeat your ZZ throughout the list. Hit enter, and it will clear the message queues that aren't in use. The ones that are in use will halt this process. When that happens, just field exit that particular message queue and hit enter to continue the process. Do this until you reach the end of the list. Once this is complete, repeat the same process for library QSYS.
I'm sure a program can be written to do this, but for those who aren't programmers or who don't want to bother typing code, this will give you an alternative.
To comment on this tip, e-mail us at Tips@search400.com
From Bob Parent:
Why not just use the cleanup commands supplied by OS/400? You would be able to specify when you'd like to run CLEANUP and how long you'd like to keep the messages, among other things. I do this daily at 05:00.
From Jack Quigley:
This should not be necessary if you use the automatic clean up options. I run it every morning at 5:00 AM when nobody is using the system. Option is set to clean all messages over five days old.
From Tom Speeg:
Why not just tell them to use "go cleanup" on daily basis? It schedules the message queue cleanups for them -- end of problem.
From Steve Griffiths:
Why not just use the system option 'CLEANUP'? Type GO CLEANUP on a command line and fill in the options.
From Jack Gipsom:
This tip is good. It provides a way to use OS/400 without coding, and that is useful whether you're a programmer or an administrator.
From Bob Schaefer:
This tip really goes about the task of cleaning up the message queues the hard way. To really do this without any intervention, try setting up the clean up job (go cleanup) and schedule it to run daily. By doing this you determine how many days worth of messages you would like to keep. Some users don't like when you delete all of their messages.
From Bronwyn Berna:
Perhaps I'm missing something, but I don't see any advantage offered by this tip when you can set the AS/400 automatic cleanup options to delete messages after a given number of days. From a command line, type GO CLEANUP and follow the options. We set our cleanup to run at 23:00 every day. We keep user messages for seven days, system and workstation for four, joblogs for seven, system journals for 30 days and calendar items for 366 days. Once this is set you can go about your business and never have to think about it again.
From Ernie Wallace:
There is another way to delete system and user messages automatically. The AS/400 provides the capability to specify automatic cleanup options using the operational assistant. No code is involved, and cleanup takes place automatically at a user-specified time every day.
Sign on as QSECOFR.
On the command line, key GO ASSIST.
Take option 11 - Manage your system, users, and devices.
Take option 2 - Cleanup tasks
Take option 1 - Change cleanup options
Make sure the Auto Cleanup option = 'Y'
Key in the time that you want auto cleanup to start, ex. 22:00:00 for 10:00pm
Under the "Number of days to keep":
Specify the number of days that you want to keep system and workstation messages.
This will add a job schedule entry to the OS/400 job schedule. To see the job, type "WRKJOBSCDE" on any command line.