IBM Support

Deleting Spooled Files based on Expiration Date or Age

Technote (troubleshooting)


Problem(Abstract)

This document provides information on deleting old spooled files based on their age or expiration date.

Resolving the problem

Is there a way to delete old spooled files based on their age or the date they were generated?

The Delete Old Spooled Files (DLTOLDSPLF) utility can be used to delete any spooled files older than a specific target date.

Starting in 5.4 (V5R4M0 or R540) i5/OS, the Delete Expired Spooled files (DLTEXPSPLF) command can be used to delete spooled files based on the value of the Expiration date for file (EXPDATE) parameter in the attributes of each individual spooled file, rather than deleting spooled files based on the date that the spooled file was created.

For more information, refer to the sections titled "Delete Expired Spooled Files (DLTEXPSPLF) command" and "Delete Old Spooled Files (DLTOLDSPLF) Utility" below. For other suggestions on reducing the amount of disk space or DASD used to store spooled files in the QSPL library, refer to the following document:

N1019109: QSPL Storage Cleanup Tips

    Delete Expired Spooled Files (DLTEXPSPLF) command

    If running V5R4M0 (R540) IBM i5/OS or V6R1M0 (R610) i5/OS, consider using the Delete Expired Spooled Files ( DLTEXPSPLF) command periodically to delete spooled files that have reached the expiration date.

    The Expiration date for file (EXPDATE) parameter defaults to *NONE, so typically no expiration date is set. However,the Expiration date for file (EXPDATE) and Days until file expires (DAYS) parameters can be set prior to generating spooled files by using the Create Printer File ( CRTPRTF), Change Printer File ( CHGPRTF) and Override with Printer File ( OVRPRTF) commands. For example:

    CRTPRTF FILE(library/printer-file)  EXPDATE(*DAYS) DAYS(30)

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

    OVRPRTF FILE(QPJOBLOG) EXPDATE(*DAYS) DAYS(30) OVRSCOPE(*JOB)

    These parameters can also be set or changed after a spooled file has been generated by using the Change Spooled File Attributes ( CHGSPLFA) command or by taking Option 8 (Attributes) from the Work with Spooled Files ( WRKSPLF) or Work with Output Queue ( WRKOUTQ) commands. For example:

    CHGSPLFA FILE(QPRTLIBL) JOB(*) SPLNBR(1) EXPDATE(*DAYS) DAYS(30)

    CHGSPLFA FILE(QPRTLIBL) JOB(*) SPLNBR(1) EXPDATE(*NONE)

    The Delete Expired Spooled Files ( DLTEXPSPLF) command can be run interactively, in a batch job, or through a job schedule entry. For example:

    DLTEXPSPLF ASPGRP(*ALL)

    SBMJOB CMD(DLTEXPSPLF ASPGRP(*ALL)) JOB(DLTEXPSPLF)

    ADDJOBSCDE JOB(DLTEXPSPLF) CMD(DLTEXPSPLF ASPGRP(*ALL)) FRQ(*WEEKLY)
               SCDDATE(*NONE) SCDDAY(*ALL) SCDTIME(010000)
               JOBQ(QSYS/QSYSNOMAX)
               TEXT('Delete expired SPLFs on a weekly basis')

    For more information, please refer to the "Deleting expired spooled files" topic in the i5/OS Information Center:

    http://publib.boulder.ibm.com/infocenter/iseries/v5r4/index.jsp?topic=/cl/dltexpsplf.htm

    and the "Delete Expired Spooled files (DLTEXPSPLF)" topic in the i5/OS Information Center:

    http://publib.boulder.ibm.com/infocenter/iseries/v5r4/index.jsp?topic=/cl/dltexpsplf.htm

    Note: If the DLTEXPSPLF command is used but an expiration date has not been set in any spooled files or no spooled files have yet expired, this command will not remove any spooled files from the system.
      Delete Old Spooled Files (DLTOLDSPLF) Utility

      Rochester Support Center knowledgebase document New contains source code for an IBM RPG/400 program called DLTOLDSPLF (Delete Old Spooled Files) that deletes any spooled files older than a specific target date.

      Note: The Delete Old Spooled Files (DLTOLDSPLF) program will still run in the V5R4M0 (R540) operating system; however, it is no longer needed in V5R4M0 because of new support for setting an expiration date on spooled files. After the expiration date is reached on the spooled files, they become eligible for removal from the system by the Delete Expired Spooled Files ( DLTEXPSPLF) command.

      Caution: The DLTOLDSPLF program is an unsupported utility. Therefore, no APARs will be accepted for problems found with this program.

      Information on the DLTOLDSPLF utility can also be found in the manual OS/400 API Appendixes V4R4, SC41-5881-03 .

      For additional information, refer to the following publication:

      OS/400 API Appendixes V4R4, SC41-5881-03 .

      For additional information, please refer to the following document:

      N1019285: Delete Old Spooled Files (DLTOLDSPLF) Sample RPG Program

      Cross reference information
      Segment Product Component Platform Version Edition
      Operating System IBM i 7.2
      Operating System IBM i 7.1
      Operating System IBM i 6.1

      Historical Number

      25751242

      Document information

      More support for: IBM i
      Print

      Software version: 4.5.0, 5.1.0, 5.2.0, 5.3.0, 5.3.5, 5.4.0, 5.4.5, 6.1, 6.1.0, 6.1.1, 7.1, 7.1.0, 7.2, 7.2.0, Version Independent

      Operating system(s): IBM i

      Reference #: N1019412

      Modified date: 26 November 2012


      Translate this page: