Delete Spool Files of 30 users (Starting with OP) using Generic Name i.e. OP*
65 pts.
0
Q:
Delete Spool Files of 30 users (Starting with OP) using Generic Name i.e. OP*
Every 3 moths we are deleting Spool files of users Starting With OP, on iSeries System using the below Program and a Display File.

This activity is performed after the Spool Files (Which needs to be deleted) are saved on Tape using BRMS.



*************** Beginning of data ************************** PGM                                                                      DCLF       FILE(QGPL/SPOOLED) OPNID(SPOOL)                  DCLF       FILE(QGPL/DLTOLDSPLF) OPNID(DISPLAY)              DCL        VAR(&SPLF) TYPE(*CHAR) LEN(10)                            DCL        VAR(&SPOOLED) TYPE(*CHAR) LEN(132)                 DCL &USER *CHAR 10                                            DCL &JOBN *CHAR 10                                            DCL &JOB# *CHAR 10                                            DCL &SPL# *CHAR 10                                            DCL &SPLDT *CHAR 8                                            DCL VAR(&SPLNO) TYPE(*DEC) LEN(5 0)                           DCL &SPLD *CHAR 8                                             DCL        VAR(&SPOOLED) TYPE(*CHAR) LEN(132)                          DCL &USER *CHAR 10                                                     DCL &JOBN *CHAR 10                                                     DCL &JOB# *CHAR 10                                                     DCL &SPL# *CHAR 10                                                     DCL &SPLDT *CHAR 8                                                     DCL VAR(&SPLNO) TYPE(*DEC) LEN(5 0)                                    DCL &SPLD *CHAR 8                                                      DCL &COFF *CHAR 8                                                      SNDRCVF    OPNID(DISPLAY)                                              IF         COND(&DISPLAY_IN03 *EQ '1') THEN(GOTO +                                CMDLBL(EXIT))                                           OVRPRTF    FILE(QPRTSPLQ) MAXRCDS(300000) HOLD (*YES)                   WRKOUTQ    OUTQ(&DISPLAY_LIB/&DISPLAY_OUTQ) OUTPUT(*PRINT)              MONMSG     MSGID(CPF9999)                                            CRTPF      FILE(QTEMP/SPOOLED) RCDLEN(132) SIZE(*NOMAX)                           MONMSG     CPF0000                                                     CPYSPLF    FILE(QPRTSPLQ) TOFILE(QGPL/SPOOLED) +                                            SPLNBR(*LAST)                                              DLTSPLF    FILE(QPRTSPLQ) SPLNBR(*LAST)                               DLTOVR     QPRTSPLQ                                       LOOP:       RCVF       OPNID(SPOOL)                                             MONMSG     MSGID(CPF0864) EXEC(DO)                                    RMVMSG     PGMQ(*SAME) CLEAR(*ALL)                                    GOTO       CMDLBL(QUIT)                                               ENDDO                                                     QUIT:                                                                         CHGVAR     VAR(&SPLF) VALUE(%SST(&SPOOL_SPOOLED 2 10))             CHGVAR     VAR(&USER) VALUE(%SST(&SPOOL_SPOOLED 13 10))            CHGVAR     VAR(&JOBN) VALUE(%SST(&SPOOL_SPOOLED 84 10))            CHGVAR     VAR(&JOB#) VALUE(%SST(&SPOOL_SPOOLED 95 6))             CHGVAR     VAR(&SPL#) VALUE(%SST(&SPOOL_SPOOLED 75 4))             CHGVAR     VAR(&SPLDT) VALUE(%SST(&SPOOL_SPOOLED 102 8))                                                               /* SEE IF THE SPOOL FILE IS PAST EXPIRATION */                               IF         COND(&SPLF = '5722SS1  V') THEN(DO)                     GOTO       CMDLBL(LOOP)                                            ENDDO                                                              IF         COND(&SPLF = 'File     ') THEN(DO)                      GOTO       CMDLBL(LOOP)                                            ENDDO                                                              CVTDAT     DATE(&SPLDT) TOVAR(&SPLD) FROMFMT(*DMY) +               CVTDAT     DATE(&DISPLAY_CUTOFF) TOVAR(&COFF) FROMFMT(*DMY+                                   ) TOFMT(*YYMD) TOSEP(*NONE)                             IF         COND(&SPLD < &COFF) THEN(DO)                               CHGVAR     VAR(&SPLNO) VALUE(&SPL#)                                   DLTSPLF    FILE(&SPLF) JOB(&JOB#/&USER/&JOBN) +                                             SPLNBR(&SPLNO)                                             MONMSG     CPF0000                                                    GOTO       CMDLBL(LOOP)                                               ENDDO                                                      EXIT:                                                                ENDPGM                                                               

****************** End of data *************************



Through the Display File we are passing 3 Parameters i.e. LIBRARY NAME (Library where the User OUTQ was Created for example - QGPL or QUSRSYS), OUTPUT QUEUE (OUTQ Name of the User for example - OPRAVIB) and Date (Upto When The Spool Files Can Be Deleted for example - 28/10/09 - DD/MM/YY FORMAT).

When we run this program using the above mentioned parameters, Spool Files till 27/10/09 Night 00:00:00, will be deleted from User OPRAVIB's OUTQ.

This is the Current Process we are following. However using this Program at a time, we can delete Spool Files from a Single OUQ only.

What if I want to Delete All Spool Files of Multiple Users using a Generic Name i.e. instead of OPRAVIB, it should delete Spool Files of All Users Starting With OP and minusing the Libray Name Parameter mentioned in the Display File.

Regards,

Haaider Ali



Software/Hardware used:
iSeries System i570, V5R4M0
ASKED: Oct 28 2009  7:33 AM GMT
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
0
6365 pts.
0
A:
 RATE THIS ANSWER
0
Click to Vote:
  •   0
  •  0
  • AddThis Social Bookmark Button
This seems to be a common question.
Here is a link to the same basic question and it has great answers.
http://itknowledgeexchange.techtarget.com/itanswers/how-to-delete-a-users-spoolfile-in-batch-by-date-range/
Last Answered: Oct 28 2009  2:14 PM GMT by CharlieBrowne   6365 pts.
0
0
Discuss This Answer:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _



_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

WoodEngineer   2240 pts.  |   Oct 28 2009  4:10PM GMT

Check out IBM’s DLTOLDSPLF. I believe we found it in an IBM Redbook. It is very useful and can be easily enhanced. The important thing is that all the “heavy lifting” has already been done by IBM. There are a number of Google references to DLTOLDSPLF.

By the way, the command allows deletion of all spool files for a given user. You could add a little code to limit to deletion to spool files with the leading characters of your choice.

 

TomLiotta   7740 pts.  |   Oct 28 2009  8:46PM GMT

Use this link for the corrected code for DLTOLDSPLF. And review the entire descriptive text in that document. It includes mention of recent features added to i5/OS for aging spooled files.

For many years, I’ve had the Age Spool Files Directory at my site for those who are beginning to investigate this kind of programming. It’s pretty old itself now and needs to be modernized, but it can be useful as a learning tool — which is why it was created.

Tom

 
0