I wrote my own SQLRPGLE program to do it.
This is my data source (I pass in number of days)
Exec Sql
Declare splcsr Cursor For
Select create_timestamp, spooled_file_name, job_name, file_number, size,
total_pages
From qsys2.output_queue_entries
Where days(current_timestamp) - days(create_timestamp) > :numDays
Order by create_timestamp;
Then loop through the results:
cmdstring = 'DLTSPLF FILE(' + splf.name + ') JOB(' + splf.jobname +
') SPLNBR(' + %char(splf.nbr) + ')';
// Exec cmdstring to delete spooled file
monitor;
qcmdexc(cmdstring:%len(cmdstring));
on-error;
Ifs_WriteLog(logFd:'CMD ERROR:' + TAB + %trim(cmdstring));
iter;
endmon;
HTH
-----Original Message-----
From: MIDRANGE-L <midrange-l-bounces@xxxxxxxxxxxxxxxxxx> On Behalf Of James H. H. Lampert via MIDRANGE-L
Sent: Tuesday, September 12, 2023 1:21 PM
To: Midrange Systems Technical Discussion <midrange-l@xxxxxxxxxxxxxxxxxx>
Cc: James H. H. Lampert <jamesl@xxxxxxxxxxxxxxxxx>
Subject: Two questions, Re: Getting rid of jobs and spool files
Ladies and Gentlemen:
1. I'd like to be able to quickly, quietly, headlessly, and
programmatically (preferably from CL) get rid of all jobs of a given
name (call it "FOOBAR" for now), whether SCD or ACTIVE. Surely this
can't be the first time this has come up. Is there an easy way to do this?
2. In the process of setting up an experiment for this, I discovered
that we had a server that was getting a steady stream of undesired
traffic in a protocol other than what it was expecting, with the result
that I had several thousand spool files, all from different (but
identically named) jobs. Is there a way to mass-delete these? All I
found was this:
<
https://www.rpgpgm.com/2020/01/delete-many-spool-files-with-one-command.html>
which doesn't seem to address the "many different identically-named
jobs" part of the problem. Anybody have any suggestions for this?
--
JHHL
As an Amazon Associate we earn from qualifying purchases.