Would like to know is there a way to delete a user's spool file in batch by date range? Is there any CL I can refer to.Please help. FYI, my iSeries model = 20 running on OS/400 V5R3M0.
Thank you in advance for your help.
Mod Note: This question was submitted to our Moderator mailbox.
Software/Hardware used:
ASKED:
October 15, 2008 3:52 PM
UPDATED:
October 29, 2009 4:29 PM
I agree with Phillip’s suggestion. Infact, I am writing a CL program as we speak to do the same.
I need a sample CL program for this, anybody can help? Thanks.
I think you’ll find some good examples if you search under
AS/400 DLTOLDSPLF or AS/400 DLTUSRSPLF
Or, if you’d like the flexibility of using APIs:
There is an API, QUSLSPL, that will produce a list of spool files which have the critiera you specify through its paramameters. This list would be written to a user space. From an RPG program (or COBOL, or whatever your preferred language is), you could read through those entries and delete them. But I haven’t been able to find an API to delete a spool file, so you could use the QCMDEXEC method, although it seems a bit roundabout to me. Or, as each entry is read, you could move it to an out queue via the QSPMOVSP API. Afterwards, you could clear that out queue.
If you happen to have TAATOOLS on your system there are a couple of utility programs that you can use to do this. It would save some time over writing it from scratch.
(Every shop I visit seems to always have a 10 year old version of TAATOOLS)
Check out DLTSPLFDAT. Herman Van Der Staey wrote a utility using the api. Not only is it a good tool but it has the techniques in it so that if you want to modify it for workspace specific tasks (such as moving old spoolfiles to a specific outq, changing spool attributes, etc).
I used the code above and the library at my company does not have the commands CVTOUTQ and ADDDAT. Is there any other commands I can use to make this code capture and delete spool files after a certain amount of days?
The CVTOUTQ & ADDDAT commands are part of TAATOOLS which was a licensed product from IBM but has since been dropped. Jim Sloan was the original author and I believe he took it with him when he left IBM. I’m not sure if you can still buy a copy or not.
Check out IBM’s DLTOLDSPLF. It includes a parm for days to retain a spool file. We use it exactly as you describe. Works great.
The code should be available for download from IBM.