Selectively clear out queues – dltsplf

170 pts.
Tags:
CLROUTQ
Any one able to share how to automate selectively deleting spool files from out queue. any code to share. Looking to delete spool files over a year old
1

Answer Wiki

Thanks. We'll let you know when a new response is added.

We do something similar here but more for monthly spool files. The code can be tweaked. we do it monthly based on a few users who create a lot of them. We just pass a username and the month as parms.

                                    

             PGM PARM(&USER &MM)                          
             DCL        VAR(&USER) TYPE(*CHAR) LEN(10)           
             DCL        VAR(&MM) TYPE(*CHAR) LEN(2)              
             DCL        VAR(&MONTH) TYPE(*CHAR) LEN(2)           
             DCL        VAR(&DATA) TYPE(*CHAR) LEN(132)          
             DCL        VAR(&SPLFILE) TYPE(*CHAR) LEN(10)        
             DCL        VAR(&NUMB) TYPE(*CHAR) LEN(10)           
             DCL        VAR(&USER) TYPE(*CHAR) LEN(10)           
             DCL        VAR(&JOB) TYPE(*CHAR) LEN(10)            
             DCL        VAR(&SPLNUM) TYPE(*CHAR) LEN(4)          
                                                                 
             DCLF       FILE(MYLIB/PRINT_CLR)                   
                                                                 
             WRKSPLF    SELECT(&USER) OUTPUT(*PRINT)             
             CPYSPLF    FILE(QPRTSPLF) TOFILE(MYLIB/PRINT_CLR) +
                          SPLNBR(*LAST)                          
                                                                 
NXTSPOOL:                                                   
             RCVF       OPNID(*NONE)                                   
             MONMSG     MSGID(CPF0000) EXEC(GOTO CMDLBL(ENDSPOOL))     
                                                                       
             CHGVAR     VAR(&SPLFILE) VALUE(%SST(&PRINT_CLR 2 10))     
             CHGVAR     VAR(&NUMB) VALUE(%SST(&PRINT_CLR 119 6))       
             CHGVAR     VAR(&USER) VALUE(%SST(&PRINT_CLR 13 10))       
             CHGVAR     VAR(&JOB) VALUE(%SST(&PRINT_CLR 108 10))       
             CHGVAR     VAR(&SPLNUM) VALUE(%SST(&PRINT_CLR 103 4))     
                                                                       
/*     ZERO FILL SPOOL NUMBER                                       */ 
             IF         COND(%SST(&SPLNUM 1 1) *EQ ' ') THEN(CHGVAR +  
                          VAR(%SST(&SPLNUM  1 1)) VALUE('0'))          
             IF         COND(%SST(&SPLNUM 2 1) *EQ ' ') THEN(CHGVAR +  
                          VAR(%SST(&SPLNUM 2 1)) VALUE('0'))           
             IF         COND(%SST(&SPLNUM 3 1) *EQ ' ') THEN(CHGVAR +  
                          VAR(%SST(&SPLNUM 3 1)) VALUE('0'))           
                                                                       
             CHGVAR     VAR(&MONTH) VALUE(%SST(&PRINT_CLR 83 2))       
             IF         COND(%SST(&MONTH 1 1) *EQ ' ') THEN(CHGVAR +   
                          VAR(%SST(&MONTH  1 1)) VALUE('0'))     
                                                              
             IF         COND(&MONTH *EQ &MM) THEN(DO)         
             DLTSPLF    FILE(&SPLFILE) JOB(&NUMB/&USER/&JOB) +
                          SPLNBR(&SPLNUM)                     
             MONMSG     MSGID(CPF0000)                        
             ENDDO                                            
                                                              
             GOTO       CMDLBL(NXTSPOOL)                      
                                                              
ENDSPOOL:                                                     
                                                               

             ENDPGM        

Discuss This Question: 4  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.
  • Subhendu Sen
    You can try with DLTSPLF command. This command helps to delete  the specified spooled file from the output queue.
    141,290 pointsBadges:
    report
  • Subhendu Sen
    141,290 pointsBadges:
    report
  • junekotey
    Very helpful article... Will explore using either dltoldsplf or dltexpsplf. Thanks for pointing me to above article
    170 pointsBadges:
    report
  • junekotey
    ToddN2000...nice code. Thanks for sharing. Now i have a few options to consider. Exactly what i am looking to do. 
    170 pointsBadges:
    report

Forgot Password

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

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

Thanks! We'll email you when relevant content is added and updated.

Following

Share this item with your network: