Finding and working with Spool files generated under a QPRTJOB job

Date:23 October 2011
Product/Release:LANSA for iSeries - All versions
Abstract:How to find the full attributes of a Spool file for a most recently produced Spool file in a job
Submitted By:LANSA Technical Support

Description:

For printing requirements or otherwise, you may need to find/locate a spool file (or retrieve its attributes) which are generated from the SuperServer, LANSA Server and LANSA for the Web jobs.

Firstly lets understand that there are various different possibilities when a job on IBM i creates a spool file.  This can happen with SuperServer, LANSA Server and Web jobs.

  1. The current user is the same as the job user and the SPLFOWN (from CRTPRTF, CHGPRTF or OVRPRTF) is *CURUSRPRF or *JOB. This is the "normal" case, e.g. when you sign into an interactive job or submit a batch job.
     
  2. The current user is different to the job user and the SPLFOWN (from CRTPRTF, CHGPRTF or OVRPRTF) is *CURUSRPRF. In this case a "dummy" QPRTJOB job is created with the current user profile name and the next job number if one doesn't already exist, or if the current one already has the maximum number of spool files.
     
  3. The current user is different to the job user and the SPLFOWN (from CRTPRTF, CHGPRTF or OVRPRTF) is *JOB. This again results in the "normal" case.
     
  4. The current user is the same as the job user and the SPLFOWN (from CRTPRTF, CHGPRTF or OVRPRTF) is *JOBGRPPRF. In this case a "dummy" QPRTJOB job is created with the job user group profile name and the next job number if one doesn't already exist, or if the current one already has the maximum number of spool files.
     
  5. The current user is different to the job user and the SPLFOWN (from CRTPRTF, CHGPRTF or OVRPRTF) is *CURGRPPRF. In this case a "dummy" QPRTJOB job is created with the current user group profile name and the next job number if one doesn't already exist, or if the existing one already has the maximum number of spool files.

In possibilities ii, iv and v the job that a spool file is part of is not the job the spool file was produced in. For these particular possibilities, it is possible for there to be more than one QPRTJOB job for the same user.

Recommendation:

There is an IBM i API called QSPRILSP, that tells you, for the most recently produced spool file in a job, what the full characteristics are for that spool file.

There is also a document on the IBM website, Reference number 409840299, title "Finding and Working with Spooled Files Generated under a QPRTJOB Job".