Here's a spool clean utility that will delete spool files older than a
specified age..

 

/*---------------------------------------------*/                     

/*  Clean up spool files for any user that is  */                     

/*  older than the specified age.              */                     

/*                                             */                     

/*  Requires: Class D privilege to purge files */                     

/*            for other spool file owners      */                     

/*                                             */                     

/*  USAGE: SPCLEAN user files age              */                     

/*                                             */                     

/*  Options:                                   */                     

/*  user  - Userid that owns the spool files   */                     

/*          or ALL to clean all spool files.   */                     

/*          Default is userid running SPCLEAN  */                     

/*                                             */                     

/*  files - Spool file type. Choices are       */                     

/*          RDR, PRT or PUN.                   */                     

/*          Default is RDR                     */                     

/*                                             */                     

/*  age   - Age of files to purge in days old  */                     

/*          Default is 30 days                 */                     

/*                                             */                     

/*  Written by: Mike Rydberg 3/6/2003          */                     

/*                                             */                     

/*---------------------------------------------*/                     

parse upper arg user files max  .                                     

                                                                      

/* set defaults */                                                    

 if user = '' | user = '*' then user = userid()                       

 if files = '' then files = 'RDR'                                     

 if max = '' then max = 30                                            

                                                                      

 recs.0 = 0                                                           

 today = date('B')                                                    

 n = 2                                                                

 /* determine if user has class D priv */                             

 cpout = DIAGRC(8,'Q F' userid() 'ALL')                               

 parse var cpout Class_D .                                            

                                                                      

 /* get list of spool files to be scanned for expiration */


 if files = 'RDR' then


  'pipe cp  Q RDR ALL FULL | stem recs. '


 


 if files = 'PRT' then


  'pipe cp  Q PRT ALL FULL | stem recs. '


 


 if files = 'PUN' then


  'pipe cp  Q PUN ALL FULL | stem recs. '


 


 if recs.0 < 2 then exit


 


 say 'Purging' user files 'files older than 'max 'days'


 


  do n=1 to recs.0


     parse var recs.n owner spid . . . . . cdate .


 


     if owner = 'OWNERID' then iterate


     if cdate \= 'OPEN-' then do


 


        /* do file date converstions to determine spool file age */


        days =
date('B',date(,translate('yearmndt',cdate,'mn/dt/year'),'S'))   

        age = today - days


 


        /* purge file if it meets the specified criteria */


        if age >= max then do


 


          /* if user has Class D priv, only delete specified users files
*/   

          if Class_D = 0 then do


             if user = 'ALL'| user = owner then do


                say 'Purging' owner files spid 'from' cdate


                cpout = DIAGRC(8,'PURGE' owner files spid )


                end


             end


         /* Can only purge their own files  */


         else do


              say 'Purging' userid() files spid 'from' cdate


              cpout = DIAGRC(8,'PURGE' files spid )


              end


         end


      end


    end


 exit                                                                   

 

 

________________________________

From: The IBM z/VM Operating System [mailto:ib...@listserv.uark.edu] On
Behalf Of Martin, Terry R. (CMS/CTR) (CTR)
Sent: Friday, December 12, 2008 4:21 PM
To: IBMVM@LISTSERV.UARK.EDU
Subject: Clean up the spool

 

Hi 

 

My spool is getting a little to big and I want to clean it up. What is
the easiest way to accomplish this? Is there a command to clear files
from the spool?. 

Asked as a 'new-be' but getting there!!

 

Thank You,

 

Terry Martin

Lockheed Martin - Information Technology

z/OS & z/VM Systems - Performance and Tuning

Cell - 443 632-4191

Work - 410 786-0386

terry.ma...@cms.hhs.gov

 

Reply via email to