Skip to main content

Maximum Spooled Files by Job

There may be times when a specific job requires more than the default number of spooled files. Here's how to increase the maximum spooled files on a job.

Dawn May i Can Blog

The system value QMAXSPLF specifies how many spooled files may be created by a single job. The default for this system value is 9,999, but it can be set as high as 999,999. The default value is good to prevent runaway jobs from creating too many spooled files, which can negatively impact the system.

However, there may be times when a specific job has a requirement to create more than 9,999 spooled files. Rather than changing the system value to allow this to occur, you should increase the limit only for the jobs that must create more spooled files.

How is this done? IBM first implemented the ability to control the maximum spooled files on a job by job basis back in the (now unsupported) 7.1 release with PTF SI54499. For those on 7.2, you need PTF SI55214 to enable this support. The function is in the base release of 7.3 and 7.4. This little gem is probably not widely known, and I haven’t found documentation on it other than the PTF cover letters.

It’s very easy to set a value for the maximum number of spooled files allowed for a job. You simply need to add a job-level environment variable for the jobs that are allowed to create more than QMAXSPLF specified spooled files.

For example:ADDENVVAR ENVVAR(QIBM_SP_MAXSPLF) LEVEL(*JOB) VALUE(99999) This environment variable supports a range of values from 1,000 to 999,999, which allows to you specify values that are greater than or less than the value in QMAXSPLF. So not only can you allow jobs to create more spooled files, you can also restrict the number of spooled files that a job can generate. The environment variable is only checked one time within a job, so if you remove the environment variable after the job has checked for its existence it will have no affect.

Note that this environment variable is ignored for QPRTJOBs as they have unique considerations for spooled file creation.

If you need to gain insight into how many spooled files your jobs are creating, you have several
options:

  • You can use the IBM i service, QSYS2.OUTPUT_QUEUE_ENTRIES_BASIC, to get a summary of the number of output queue entries ordered by job. However, this is just the spooled files that are on the output queues and does not take into account spooled files that may have been deleted and no longer exist.
  • Collection Services keeps track of the number of spooled files created by a job in the QAPMJOBOS file in field JBSPLFC. This is an accumulating counter of the number of spooled files created by the job. You can query this file to find the number of spooled files created by jobs. Note that the collection will only contain data for the jobs that were in the system during the collection, so you have to track this data over time to find the jobs that generate the most spooled files.
  • Navigator for i System Monitors have a metric, Spool File Creation Rate, that was one of the new monitor metrics introduced with IBM i 7.2. This metric allows you to monitor the creation rate of spooled files on the partition (not for a specific job). This is useful to identify situations where a job may be creating many more spooled files than is typical. The underlying System Monitor file, QAPMSMJOS, has the detailed information about spooled files created by jobs, which would allow you to identify the job(s) causing the issue. You must enable system monitoring for operating system job data to have this information collected.
  • System Health Services keeps track of the jobs that create large numbers of spooled files; you can query the QSYS2.SYSLIMITS view for limit ID of 19001, which is the maximum number of spooled files for a job. Note that with the system limits support, information is not tracked until a certain level is reached, so if there are not a lot of spooled files created by an individual job, you may not see any information.

A useful reference for IBM documentation on managing jobs and spooled files is the Best Practices for Managing Jobs and Spooled Files Redpaper; while published many years ago, the information in this document is still pertinent.


Key Enterprises LLC is committed to ensuring digital accessibility for techchannel.com for people with disabilities. We are continually improving the user experience for everyone, and applying the relevant accessibility standards.