• 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
    DRV Tech

    Get More Out of Your IBM i

    With soaring costs, operational data is more critical than ever. IBM shops need faster, easier ways to distribute IBM applications-based data to users more efficiently, no matter where they are.

    The Problem:

    For Users, IBM Data Can Be Difficult to Get To

    IBM Applications generate reports as spooled files, originally designed to be printed. Often those reports are packed together with so much data it makes them difficult to read. Add to that hardcopy is a pain to distribute. User-friendly formats like Excel and PDF are better, offering sorting, searching, and easy portability but getting IBM reports into these formats can be tricky without the right tools.

    The Solution:

    IBM i Reports can easily be converted to easy to read and share formats like Excel and PDF and Delivered by Email

    Converting IBM i, iSeries, and AS400 reports into Excel and PDF is now a lot easier with SpoolFlex software by DRV Tech.  If you or your users are still doing this manually, think how much time is wasted dragging and reformatting to make a report readable. How much time would be saved if they were automatically formatted correctly and delivered to one or multiple recipients.

    SpoolFlex converts spooled files to Excel and PDF, automatically emailing them, and saving copies to network shared folders. SpoolFlex converts complex reports to Excel, removing unwanted headers, splitting large reports out for individual recipients, and delivering to users whether they are at the office or working from home.

    Watch our 2-minute video and see DRV’s powerful SpoolFlex software can solve your file conversion challenges.

    Watch Video

    DRV Tech

    www.drvtech.com

    866.378.3366

    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

  • The Power11 Transistor Count Discrepancies Explained – Sort Of
  • Is Your IBM i HA/DR Actually Tested – Or Just Installed?
  • Big Blue Delivers IBM i Customer Requests In ACS Update
  • New DbToo SDK Hooks RPG And Db2 For i To External Services
  • IBM i PTF Guide, Volume 27, Number 33
  • Tool Aims To Streamline Git Integration For Old School IBM i Devs
  • IBM To Add Full System Replication And FlashCopy To PowerHA
  • Guru: Decoding Base64 ASCII
  • The Price Tweaking Continues For Power Systems
  • IBM i PTF Guide, Volume 27, Numbers 31 And 32

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