We currently use the below CL and it works great – Adam V.
<pre> PGM
/* Declare Files and Variables */
DCL VAR(&SPLDAYSOLD) TYPE(*DEC) LEN(2 0) VALUE(-14)
DCL VAR(&NEWDATE) TYPE(*CHAR) LEN(6)
DCL VAR(&CYMDDATE) TYPE(*CHAR) LEN(8)
DCL VAR(&SPLDATE) TYPE(*CHAR) LEN(8)
CVTOUTQ OUTQ(QPRINT) OUTLIB(QGPL)
MONMSG MSGID(CPF2479)
MONMSG MSGID(CPF4903)
MONMSG MSGID(CPF9898)
MONMSG MSGID(CPF9999)
CVTOUTQ OUTQ(OPTIOWO01) OUTLIB(QGPL) REPLACE(*NO)
MONMSG MSGID(CPF2479)
MONMSG MSGID(CPF4903)
MONMSG MSGID(CPF9898)
MONMSG MSGID(CPF9999)
/* more queues here, etc….*/
DCLF FILE(*LIBL/OUTQP)
/* Setup the date for deleting the spool files */
ADDDAT DAYS(&SPLDAYSOLD) TOVAR(&NEWDATE)
CVTDAT DATE(&NEWDATE) TOVAR(&CYMDDATE) FROMFMT(*MDY) +
TOFMT(*YYMD) TOSEP(*NONE)
/* Read through the spoolfiles and determine which should be */
/* purged based on the date ord User Data… */
READ: RCVF
MONMSG MSGID(CPF0864) EXEC(GOTO CMDLBL(EOF))
CVTDAT DATE(&SPDAT) TOVAR(&SPLDATE) FROMFMT(*YMD) +
TOFMT(*YYMD) TOSEP(*NONE)
IF COND(&SPLDATE *LE &CYMDDATE *AND &SPUDTA *NE +
‘DALYSALE’ *AND &SPUDTA *NE ‘PRODUCTION’) +
THEN(DO)
DLTSPLF FILE(&SPFILE) JOB(&SPJNBR/&SPUSER/&SPJNAM) +
SPLNBR(&SPFNBR)
MONMSG MSGID(CPF0000)
ENDDO
GOTO CMDLBL(READ)
EOF: CLRPFM FILE(*LIBL/OUTQP)
MONMSG MSGID(CPF0000)
ENDPGM </pre>
////////////////////////////////////////////////////////////////////////////////
hi AUNumberOne
These commands are in TAATOOL’s – if you don’t have it you should.
CVTOUTQ – do a wrkoutq to *print – cpySPLF to a flat file then as you read the file
you will need to substring for the info you need
ADDDAT
Today is 03/06/09 if I wanted to delete everything 10 days old how can you compute that date
to compare with the date from the record you’re reading. – little RPG program or some 20 lines of
cl to compute the date. You will probably need to use CVTDAT on the record date to put it in a useable format.
Phil
Discuss This Question: 9  Replies