• The Four Hundred
  • Subscribe
  • Media Kit
  • Contributors
  • About Us
  • Contact
Menu
  • The Four Hundred
  • Subscribe
  • Media Kit
  • Contributors
  • About Us
  • Contact
  • Automatically Deleting Spooled Files through Expiration Dates

    March 23, 2011 Hey, Joe

    Last year, I stumbled on a cool method for automatically deleting spooled files. When you create a spooled file, you can set the number of days that you want to keep that file on your system. Then once a night, you can submit a job that runs the Delete Expired Spooled Files (DLTEXPSPLF) command that will automatically delete expired spooled files. You should try it.

    –Peter

    After working with the Power i and its antecedents for almost 30 years, I always find it interesting when somebody shows me something valuable that I haven’t used before. DLTEXPSPLF is a simple command that automatically removes all expired spooled files from all the system Auxiliary Storage Pools (ASPs) or the system ASP on your iSeries, System i, and Power i partitions.

    DLTEXPSPLF takes a little planning because spooled files don’t just expire on their own accord. Rather, you have to configure each spooled file with its own expiration date for later removal. This can be done before or after the spooled file is created.

    To really understand DLTEXPSPLF, it’s best to look at an example. Let’s say that we want to set up all our INVOICE spooled files to automatically be deleted from the system after 30 days. We can easily do this by making the following changes.

    1.Change the printer file that is used to create your target spooled file, so that it includes a target expiration period for newly created invoices–Let’s assume you’re using a third-party accounting package that uses a printer file called INVOICE to create all your invoice spooled files. If we want to designate that all INVOICE spooled files will expire after 30 days, we can change the EXPIRATION DATE FOR FILE (EXPDATE) parameter to *DAYS and the DAYS UNTIL FILE EXPIRES (DAYS) parameter to 30 days inside the INVOICE printer file. For this modification, we can simply run the following CHANGE PRINTER FILE (CHGPRTF) command.

    CHGPRTF FILE(INVOICE) EXPDATE(*DAYS) DAYS(30)
    

    This command changes the printer file immediately so all new invoices will automatically be tagged with an expiration date of 30 days past their creation dates. Note that this will work for any spooled files that are created through an associated printer file. Altering source printer file parameters can serve as an easy way to set different expiration dates for different types of spooled files.

    2. Set up a daily job to delete all spooled files that have expired during the previous day–This can be done either through IBM‘s job scheduler or through a third-party i/OS job scheduler such as Help/Systems’ Robot/SCHEDULE. Run DLTEXPSPLF this way in your scheduled job if you want to delete expired spooled files in all of your ASPs.

    DLTEXPSPLF ASPGRP(*ALL)
    

    Run DLTEXPSPLF this way if you only want to delete expired spooled files in your system ASP (ASP 1).

    DLTEXPSPLF ASPGRP(*SYSBAS)
    

    Spooled files always expire at 23:59:59 military time on their expiration date. So if you run DLTEXPSPLF once a day, it will delete all the spooled files that expired the day before.

    To add an entry to the IBM job scheduler for running DLTEXPSPLF on a daily schedule, you can run the following ADD JOB SCHEDULER ENTRY (ADDJOBSCDE) command that IBM lists in its i5/OS V5R4 Information Center entry on DLTEXPSPLF.

    ADDJOBSCDE   JOB(DLTEXPSPLF)  CMD(DLTEXPSPLF  ASPGRP(*ALL))            
    FRQ(*WEEKLY)  SCDDATE(*NONE)  SCDDAY(*ALL)SCDTIME(010000)  
    JOBQ(QSYS/QSYSNOMAX) TEXT('DELETE EXPIRED SPOOLED FILES SCHEDULE ENTRY')
    

    And that’s all there is to automatically deleting your job logs. If you want to add any other types of spooled files to your automatic deletion schedule, change their print file attributes, provided you can find the print file they are created from.

    You can also change spooled file expiration dates on the fly by running the CHANGE SPOOLED FILE ATTRIBUTES (CHGSPLFA) command to modify the expiration dates of files as they are created or as they sit in an output queue. To change the expiration date on a recently created spooled file to 30 days, all you have to do is gather the relevant spooled file information and run the following CHGSPLFA command.

    CHGSPLFA   FILE(spooled file name) JOB(job number/user name/job name) 
    SPLNBR(spooled file number) EXPDATE(*DAYS) DAYS(30)
    

    If you don’t want to mess around with changing expiration dates on the fly, you can create your own program to change the expiration dates for all spooled files in an output queue. A few years, I wrote a program called MOVSPLF that was used to move spooled files from one output queue to another. This program creates a work file of all the spooled files in a particular output queue and uses CHGSPLFA to move each spooled file to another output queue. With a little modification, you can easily change MOVSPLF to set expiration dates for all the spooled files in an output queue. Click here to check out the architecture and code for the MOVSPLF program.

    –Joe

    RELATED STORY

    Admin Alert: Automatically Moving Printed Spooled Files Between Output Queues



                         Post this story to del.icio.us
                   Post this story to Digg
        Post this story to Slashdot

    Share this:

    • Reddit
    • Facebook
    • LinkedIn
    • Twitter
    • Email

    Tags:

    Sponsored by
    WorksRight Software

    Do you need area code information?
    Do you need ZIP Code information?
    Do you need ZIP+4 information?
    Do you need city name information?
    Do you need county information?
    Do you need a nearest dealer locator system?

    We can HELP! We have affordable AS/400 software and data to do all of the above. Whether you need a simple city name retrieval system or a sophisticated CASS postal coding system, we have it for you!

    The ZIP/CITY system is based on 5-digit ZIP Codes. You can retrieve city names, state names, county names, area codes, time zones, latitude, longitude, and more just by knowing the ZIP Code. We supply information on all the latest area code changes. A nearest dealer locator function is also included. ZIP/CITY includes software, data, monthly updates, and unlimited support. The cost is $495 per year.

    PER/ZIP4 is a sophisticated CASS certified postal coding system for assigning ZIP Codes, ZIP+4, carrier route, and delivery point codes. PER/ZIP4 also provides county names and FIPS codes. PER/ZIP4 can be used interactively, in batch, and with callable programs. PER/ZIP4 includes software, data, monthly updates, and unlimited support. The cost is $3,900 for the first year, and $1,950 for renewal.

    Just call us and we’ll arrange for 30 days FREE use of either ZIP/CITY or PER/ZIP4.

    WorksRight Software, Inc.
    Phone: 601-856-8337
    Fax: 601-856-9432
    Email: software@worksright.com
    Website: www.worksright.com

    Share this:

    • Reddit
    • Facebook
    • LinkedIn
    • Twitter
    • Email

    Sponsored Links

    SEQUEL Software:  FREE Webinar: Overcoming query limits with SEQUEL. March 23
    Northeast User Groups Conference:  21th Annual Conference, April 11 - 13, Framingham, MA
    looksoftware:  Integrate IBM i apps with web services. FREE on-demand webinar and white paper!

    IT Jungle Store Top Book Picks

    BACK IN STOCK: Easy Steps to Internet Programming for System i: List Price, $49.95

    The iSeries Express Web Implementer's Guide: List Price, $49.95
    The iSeries Pocket Database Guide: List Price, $59
    The iSeries Pocket SQL Guide: List Price, $59
    The iSeries Pocket WebFacing Primer: List Price, $39
    Migrating to WebSphere Express for iSeries: List Price, $49
    Getting Started with WebSphere Express for iSeries: List Price, $49
    The All-Everything Operating System: List Price, $35
    The Best Joomla! Tutorial Ever!: List Price, $19.95

    Infor Touts License Fee Growth, Expansion Plans Security of SecurID In Question Following Hack of RSA

    Leave a Reply Cancel reply

Volume 11, Number 11 -- March 23, 2011
THIS ISSUE SPONSORED BY:

Bytware
ProData Computer Services
Twin Data Corporation

Table of Contents

  • Taking RSE to Task
  • Today’s Horoscope
  • Admin Alert: Must Your Rack Be IBM Black?
  • Duplicating an Entire Table or a Subset of a Table Using SQL
  • No Truncate Table? No Problem!
  • Automatically Deleting Spooled Files through Expiration Dates

Content archive

  • The Four Hundred
  • Four Hundred Stuff
  • Four Hundred Guru

Recent Posts

  • Meet The Next Gen Of IBMers Helping To Build IBM i
  • Looks Like IBM Is Building A Linux-Like PASE For IBM i After All
  • Will Independent IBM i Clouds Survive PowerVS?
  • Now, IBM Is Jacking Up Hardware Maintenance Prices
  • IBM i PTF Guide, Volume 27, Number 24
  • Big Blue Raises IBM i License Transfer Fees, Other Prices
  • Keep The IBM i Youth Movement Going With More Training, Better Tools
  • Remain Begins Migrating DevOps Tools To VS Code
  • IBM Readies LTO-10 Tape Drives And Libraries
  • IBM i PTF Guide, Volume 27, Number 23

Subscribe

To get news from IT Jungle sent to your inbox every week, subscribe to our newsletter.

Pages

  • About Us
  • Contact
  • Contributors
  • Four Hundred Monitor
  • IBM i PTF Guide
  • Media Kit
  • Subscribe

Search

Copyright © 2025 IT Jungle