The spooled file APIs can be used to obtain specific information about
spooled files. For example, the spooled file APIs can:
Return a list of spooled files based on given selection criteria, such as a
user or an output queue.
Provide functions to access a specific spooled file from which the API can
return the attributes and data of a spooled file or create a duplicate of a
specific spooled file.
The spooled file APIs are useful in writing applications to clean up, save,
and restore spooled files.
The spooled file APIs include:
Close Spooled File (QSPCLOSP) closes a spooled file opened by the Open Spooled File (QSPOPNSP) API or created by the Create Spooled File (QSPCRTSP) API.
Create Spooled File (QSPCRTSP) creates a spooled file. The attributes for the spooled file are based on the values taken from the spooled file attributes parameter. When this spooled file is created, it does not contain any data.
Get Spooled File Data (QSPGETSP) gets data from an existing spooled file. The existing spooled file must have been opened by the Open Spooled File (QSPOPNSP) API. Data is retrieved from the existing spooled file by buffers (one or more) and stored in a user space. The data in the user space is used as source to the Put Spooled File Data (QSPPUTSP) API, which puts the data in the newly created spooled file.
List Spooled File AFPDS Resources (QGSLRSC) generates a list of the AFPDS resources found in the specified spooled file and returns the list in a user space.
List Spooled Files (QUSLSPL) generates a list of spooled files on the system into a user space. The list can include all spooled files or those of specific users, output queues, form types, or user-specified data values.
Move Spooled File (QSPMOVSP) moves spooled files from one position to another position within the same output queue or from one output queue to another output queue. The priority and status of the moved spooled file can be affected by the user's priority level and the status of the spooled file.
Open List of Spooled Files (QGYOLSPL) generates a list of spooled files on the system. It creates a list similar to the list created by calling the List Spooled Files (QUSLSPL) API. The list can include all spooled files or those of specific users, output queues, form types, user-specified data values, statuses, printers, or specific jobs. The filtered list can then be sorted depending on the value of the sort parameter. You can specify how many list entries to return when calling this API. At a later time, you can request additional entries from the list using the Get List Entries (QGYGTLE) API. You can close this list by using the Close List (QGYCLST) API.
Open Spooled File (QSPOPNSP) opens an existing spooled file. After the existing spooled file is opened, the Get Spooled File Data (QSPGETSP) API can then get the data and put it in the user space.
Put Spooled File Data (QSPPUTSP) puts data into a spooled file that was created using the Create Spooled File Data (QSPCRTSP) API. The data put in the spooled file is taken from a user space. The data in the user space can be created by either using the Get Spooled File Data (QSPGETSP) API or a user application.
Retrieve Spool Information (QSPSPLI) returns information about the spooling environment on the system such as the number of spooled files in an ASP group or the number of spooled files owned by a user
Retrieve Spooled File Attributes (QUSRSPLA) returns specific information about a spooled file into a receiver variable. The size of the receiver variable determines the amount of information returned. You can specify the spooled file for which information is returned either with the internal job and spooled file identifiers, or with a specific job name, spooled file name, and spooled file number.
The spooled file exit programs are:
Spooled File Security (QIBM_QSP_SECURITY) allows registered exit programs to approve or reject spooled file commands and API calls on a case-by-case basis.
UIM Spooled File User-defined List Action (QIBM_QSP_SPLF_LSTACT) adds support for user-defined list actions on spooled files listed through the use of the Work with Spooled Files (WRKSPLF), Work with Output Queue (WRKOUTQ), and Work with Job (WRKJOB) CL commands.