I want to delete spool files older than e.g. 7 days on certain output queues. I think, that I have seen a command...
for that in TAATOOL long ago. I don't have access to that anymore, so how to I get it done automatically?
Here is a CL program I had to write just for this reason The LIBRARY of the OUTQ and the OUTQ itself are the first input parm. The other is the number of days to save. All I'm really doing is dumping the contents of the OUTQ to a printer file, copying that spool file to a database file, then reading the contents. I wrote this with the parms and not hard coded so I can run this on an AS400, any OUTQ, for any given time.
OVRPRTF FILE(QPRTSPLQ) MAXRCDS(300000) HOLD(*YES) WRKOUTQ OUTQ(&LIBR/&OUTQ) OUTPUT(*PRINT) CRTPF FILE(QTEMP/SPOOLED) RCDLEN(132) SIZE(*NOMAX) MONMSG CPF0000 CPYSPLF FILE(QPRTSPLQ) TOFILE(QTEMP/SPOOLED) + SPLNBR(*LAST) DLTSPLF FILE(QPRTSPLQ) SPLNBR(*LAST) DLTOVR QPRTSPLQ LOOP: RCVF MONMSG MSGID(CPF0864) EXEC(DO) RMVMSG PGMQ(*SAME) CLEAR(*ALL) GOTO CMDLBL(QUIT) ENDDO CHGVAR VAR(&SPLF) VALUE(%SST(&SPOOLED 2 10)) CHGVAR VAR(&USER) VALUE(%SST(&SPOOLED 13 10)) CHGVAR VAR(&JOBN) VALUE(%SST(&SPOOLED 82 10)) CHGVAR VAR(&JOB#) VALUE(%SST(&SPOOLED 93 6)) CHGVAR VAR(&SPL#) VALUE(%SST(&SPOOLED 73 4)) CHGVAR VAR(&SPLDT) VALUE(%SST(&SPOOLED 100 8)) /* */ /* See if the spool file is past expiration */ /* */ CVTDAT DATE(&SPLDT) TOVAR(&SPLD) FROMFMT(*MDY) + TOFMT(*YYMD) TOSEP(*NONE) IF COND(&SPLD < &CUTOFF) THEN(DO) CHGVAR VAR(&SPLNO) VALUE(&SPL#) DLTSPLF FILE(&SPLF) JOB(&JOB#/&USER/&JOBN) + SPLNBR(&SPLNO) MONMSG CPF0000 ENDDO
Dig Deeper on Performance
Have a question for an expert?
Please add a title for your question
Get answers from a TechTarget expert on whatever's puzzling you.