Information Systems:OUTQCLEAR

From uniWIKI
Revision as of 10:53, 9 February 2016 by Sheilav (talk | contribs)
Jump to navigation Jump to search

Runs a query against a file of all entries in out queues PRT01 and QPRINT, and builds a file of reports that can be deleted. Then reads that file, and deletes them. This is called by EODCLR.

/* Write list of spool files in out queues PRT01 and QPRINT to spool     */
/* files, then copy those spool files to a data file.                    */

            WRKOUTQ    OUTQ(PRT01) OUTPUT(*PRINT)                    
            CPYSPLF    FILE(QPRTSPLQ) TOFILE(REPORT) SPLNBR(*LAST) + 
                         TOMBR(OUTQ)                                 
            WRKOUTQ    OUTQ(QPRINT) OUTPUT(*PRINT)                   
            CPYSPLF    FILE(QPRTSPLQ) TOFILE(REPORT) SPLNBR(*LAST) + 
                         TOMBR(OUTQ) MBROPT(*ADD)   

/* Run a query to build a file of all spool files that can be deleted.   */
/* This query has a list of reports that are never printed.              */
                
            RUNQRY     QRY(OUTQCLR) QRYFILE((*LIBL/REPORT))          
                          
/* Read through the created file, and delete those spool files in it.    */
                                           
NEXT:                                                                 
            RCVF       RCDFMT(OUTQDEL)                               
            MONMSG     MSGID(CPF0864) EXEC(GOTO CMDLBL(END))         
            CHGVAR     VAR(&NUMBER) VALUE(&FILENUMB)                 
            DLTSPLF    FILE(&FILE) JOB(&JOBNUMB/&USER/&JOB) +        
                         SPLNBR(&NUMBER)                             
            GOTO       CMDLBL(NEXT)                                  
                                                                     
END:    

/* Delete the two spool files that were created.                        */

            DLTSPLF    FILE(QPRTSPLQ) SPLNBR(*LAST)                  
            DLTSPLF    FILE(QPRTSPLQ) SPLNBR(*LAST)