Ask the Expert

Deleting older spool files

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 

This was first published in April 2001

There are Comments. Add yours.

 
TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
Sort by: OldestNewest

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to: