Informing the IBM Community

Deleting Old Spool Files – DLTOLDSPLF


OK, so nobody likes tidying up, not at home, not in the office and certainly not on their computers.  How many spool files are there sitting on your system right now that deserve a “Long Service Award” because of the amount of time they’ve been in your company?

It’s a pain I know, removing spool files is like cleaning out the freezer, a job best left for tomorrow.

What if we could make it easy to delete spool files, simply by removing older ones.  Well in this article I’ll show you how.

Why bother deleting spool files?

Two reasons spring to mind, firstly they take up disk space and (usually) increase your backup window. Secondly, and perhaps more importantly, they can affect the performance of your system and in extreme cases actually bring a system down!

Focusing on the second point for a moment, spool files are associated with jobs and whilst the spool file still exists the job still exists and whilst the job still exists the system has to manage it. The more jobs a system has to manage, the more resource it takes to manage them.

Next time you have a moment run a WRKSYSSTS and take a look at the total number of jobs in your system, sample below. If that number is more than 10,000 ask yourself, do I really need to maintain that many jobs?


Now 10,000 is not a magic figure and it’s perfectly possible that you might need to run a system with many more than that but if you do you need to be mindful that these jobs bring with them an overhead.

ProTip: Check that your system value QTOTJOB is greater than the typical number of jobs you have in your system.

Deleting spool files

If you feel like bringing a sledge hammer to the party, you can always use the clear output queue (CLROUTQ) command to purge all the spools it contains in a single command.  Or being slightly more delicate you can use the delete spool file (DLTSPLF) with the *SELECT function to target specific combinations of User, Device, Form Type, User Data and ASP.

But to be honest, neither of these methods are really satisfactory as they miss the ability to delete spool files based on their age.

Expired Spool Files

IBM claim to have fixed this in v5.4 by introducing the concept of a spool file expiry date and the delete expired spool file (DLTEXPSPLF) command but in my opinion they missed the point here by creating a solution that was more complex to administer than the problem.

In short, you can set the spool files to have an expiry date after which the DLTEXPSPLF command will remove them. This expiry date can be a specific date or a number of days.  It can be changed on a per spool file basis or set by the printer file that creates the spool. Examples of setting this for a specific spool file or for a printer file are shown below :



But again, at best these are blunt instruments because when you run the DLTEXPSPLF command you can only select which ASP you are going to purge.  Worse, the act of administering which spools are to be expired and by when is more complex than the deleting process.

Delete Old Spool Files (DLTOLDSPLF)

What we actually need is a command that allows you to delete spool files based on how old they are.  Let’s face it, if a spool file is 5 years old there is very little chance that you want to keep it.

One of those nice guys at Rochester did create such a utility (thank you Rochester User V2KEA261, whoever you are) and this can be freely downloaded and installed in minutes from the link below.

In the example below I delete all spools from all output queues that were created on or before 30th April 2016


Still a little on the blunt side

Yes, this is still a little on the blunt side as you cannot select specific users or form types or even not to delete spools that are held or set to be saved but all is not lost. At that same link IBM also published the source code to this utility and so one of you clever souls can always add this functionality and repost the updated utility for us all to share.

And if you don’t have a website of your own to post it on, please send it to us and we will gladly make it available here at Powerwire.


Nice to see you

iUG LogoWell Christmas is nearly here and chances are the next time I post an article it will be 2017.  So let me wish you and your Power Systems a very Merry Christmas and a Happy, Healthy, Down-time free New Year.

I hope to see you at one of our i-UG events in 2017, we will be putting on two events in March, the first in Rochdale and the second in London.
Ho Ho Ho!

How useful was this post?

Click on a star to rate it!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate this post.