List Spooled Files (QUSLSPL) API


  Required Parameter Group:


  Optional Parameter Group 1:


  Optional Parameter Group 2:


  Optional Parameter Group 3:


  Optional Parameter Group 4:


  Optional Parameter Group 5:


  Default Public Authority: *USE

  Threadsafe: No

The List Spooled Files (QUSLSPL) API is similar to the Work with Spooled Files (WRKSPLF) command or the Work with Job (WRKJOB OPTION(*SPLF)) command. The API generates a list of spooled files on the system and places the list in a user space. The list can include some of the following:

The generated list replaces any existing information in the user space.


Authorities and Locks

User Space Authority
*CHANGE
Library Authority
*EXECUTE
User Space Lock
*EXCLRD

Output Queue Authority

The requester is authorized to the output queue if one or more of the following conditions are met:


Required Parameter Group

Qualified user space name
INPUT; CHAR(20)

The user space that receives the generated list, and the library in which it is located. The first 10 characters contain the user space name, and the second 10 characters contain the library name.

You can use these special values for the library name:


Format name
INPUT; CHAR(8)

The format of the spooled file information being returned. You must specify the following:


User name
INPUT; CHAR(10)

The name of the user whose spooled files are included in the list. This parameter can be used in conjunction with the output queue and library name, form type, user-specified data, auxiliary storage pool, job system name, starting spooled file create date, starting spooled file create time, ending spooled file create date, and ending spooled file create timeparameters to return a partial list of all the spooled files. The list of spooled files returned is sorted by status, output priority, date, and time. It must be blank if the qualified job name parameter is specified.

A value must be specified if the qualified job name parameter is blank or not specified. Otherwise, message CPF34C6 or CPD34C6 is issued.

The possible special values are:


Qualified output queue name
INPUT; CHAR(20)

The name of the output queue whose files are to be included in the list, and the library in which it is located. The first 10 characters contain the output queue name, and the second 10 characters contain the library name. This parameter can be used in conjunction with the user name, form type, user-specified data, auxiliary storage pool, job system name, starting spooled file create date, starting spooled file create time, ending spooled file create date, and ending spooled file create time parameters to return a partial list of all the spooled files. The list of spooled files returned is sorted by status, output priority, date, and time. It must be blank if the qualified job name parameter is specified.

Note: A value must be specified if the qualified job name parameter is blank or not specified. Otherwise, message CPF34C6 or CPD34C6 is issued.

You can use this special value for the output queue name:


You can use these special values for the library name:


Form type
INPUT; CHAR(10)

The form type whose files are included in the list. The form type is the value specified on the form type parameter of the printer file. This parameter can be used in conjunction with the user name, qualified output queue name, user-specified data, auxiliary storage pool, job system name, starting spooled file create date, starting spooled file create time, ending spooled file create date, and ending spooled file create time parameters to return a partial list of all the spooled files. The list of spooled files returned is sorted by status, output priority, date, and time. It must be blank if the qualified job name parameter is specified.

The special values supported are:


User-specified data
INPUT; CHAR(10)

The user-specified data value whose files are to be included in the list. This parameter can be used in conjunction with the user name, qualified output queue name, form type, auxiliary storage pool, job system name, starting spooled file create date, starting spooled file create time, ending spooled file create date, and ending spooled file create time parameters to return a partial list of all the spooled files. The list of spooled files returned is sorted by status, output priority, date, and time. It must be blank if the qualified job name parameter is specified.

The special value supported is:


Optional Parameter Group 1

Error code
I/O; CHAR(*)

The structure in which to return error information. For the format of the structure, see Error code parameter. If this parameter is omitted, diagnostic and escape messages are issued to the application.


Optional Parameter Group 2

Qualified job name
INPUT; CHAR(26)

The qualified job name of the job whose spooled files are to be included in the list. If the user name, the qualified output queue name, the form type, user-specified data, or auxiliary storage pool is specified, this parameter must be blank. Otherwise, message CPF34C2 is issued. The list of spooled files returned is sorted by spooled file number.

The qualified job name has three parts:

If this parameter is omitted, the API assumes all blanks.

Keys for the fields to return
INPUT; ARRAY(*) of BINARY(4)

The list of the fields to be returned in the SPLF0200 format. By specifying a set of keys, only the fields whose keys are specified are in the returned format. See Valid Keys for a list of valid keys. This field is only used for the SPLF0200 format. This field is ignored if the number of keys for fields to return parameter is 0.

Number of fields to return
INPUT; BINARY(4)

The number of fields to return in the SPLF0200 format. This indicates how many keys are in the array of the keys for the fields to return parameter. This field is used for the SPLF0200 format only, and it must be 0 when the SPLF0100, SPLF0300, or SPLF0400 format is specified.

If this parameter is omitted, the API assumes 0.

Optional Parameter Group 3

Auxiliary storage pool (ASP)
INPUT; BINARY(4)

The auxiliary storage pool whose spooled files are to be included in the list. This parameter can be used in conjunction with the user name, qualified output queue name, form type, user-specified data, job system name, starting spooled file create date, starting spooled file create time, ending spooled file create date, and ending spooled file create time parameters to return a partial list of all the spooled files. The list of spooled files returned is sorted by status, output priority, date, and time. It must be blank if the qualified job name parameter is specified.

The valid values are:


Optional Parameter Group 4

Job system name
INPUT; Char(8)

The name of the system where the job, specified in the qualified job name parameter, was run. This parameter can be used in conjunction with the user name, qualified output queue name, form type, user-specified data, auxiliary storage pool, starting spooled file create date, starting spooled file create time, ending spooled file create date, ending spooled file create time, or qualified job name parameters to return a partial list of all the spooled files. The list of spooled files returned is sorted by status, output priority, date, and time.

The following special values are supported for this parameter:

If this parameter is omitted, the API assumes *ALL.

Starting spooled file create date
INPUT; Char(7)

The date, based on local job time, that the spooled file was created on the system. This parameter can be used in conjunction with the user name, qualified output queue name, form type, user-specified data, auxiliary storage pool, job system name, starting spooled file create time, ending spooled file create date, ending spooled file create time, or qualified job name parameters to return a partial list of all the spooled files. The list of spooled files returned is sorted by status, output priority, date, and time. The date must be in the CYYMMDD format or one of the following special values:


The date format CYYMMDD is defined as follows:


Starting spooled file create time
INPUT; Char(6)

The time, in local job time, that the spooled file was created on the system. This parameter can be used in conjunction with the user name, qualified output queue name, form type, user-specified data, auxiliary storage pool, job system name, starting spooled file create date, ending spooled file create date, ending spooled file create time, or qualified job name parameters to return a partial list of all the spooled files. The list of spooled files returned is sorted by status, output priority, date, and time. This parameter must be set to blanks when special value *ALL or *FIRST is used for parameter Starting spooled file create date. This parameter must have a value set if a date is specified for parameter Starting spooled file create date. The time must be in the HHMMSS format.

The time format HHMMSS is defined as follows:


Ending spooled file create date
INPUT; Char(7)

The date, based on local job time, that the spooled file was created on the system. This parameter can be used in conjunction with the user name, qualified output queue name, form type, user-specified data, auxiliary storage pool, job system name, starting spooled file create date, starting spooled file create time, ending spooled file create time, or qualified job name parameters to return a partial list of all the spooled files. The list of spooled files returned is sorted by status, output priority, date, and time. If the Starting spooled file create date parameter is set to *ALL, then this parameter must be set to blanks. If a date has been specified for the Starting spooled file create date parameter, then this parameter must be set to a valid date. The date must be in the CYYMMDD format or one of the following special values:


The date format CYYMMDD is defined as follows:


Ending spooled file create time
INPUT; Char(6)

The time, in local job time, that the spooled file was created on the system. This parameter can be used in conjunction with the user name, qualified output queue name, form type, user-specified data, auxiliary storage pool, job system name, starting spooled file create date, starting spooled file create time, ending spooled file create date, or qualified job name parameters to return a partial list of all the spooled files. The list of spooled files returned is sorted by status, output priority, date, and time. This parameter must be set to blanks when special value *ALL is used for parameter Starting spooled file create date or when special value *LAST is used for parameter Ending spooled file create date. This parameter must have a value set if a date is specified for parameter Ending spooled file create date. The time must be in the HHMMSS format.

The time format HHMMSS is defined as follows:

Optional Parameter Group 5

Auxiliary storage pool (ASP) device name
INPUT; Char(10)

The auxiliary storage pool device name from which spooled files are to be included in the list. When 0 or -2 is specified on the Auxiliary storage pool parameter, this parameter can be used in conjunction with the user name, qualified output queue name, form type, user-specified data, job system name, starting spooled file create date, starting spooled file create time, ending spooled file create date, and ending spooled file create time parameters to return a partial list of all the spooled files. The list of spooled files returned is sorted by status, output priority, date, and time.

The valid values are:

If this parameter is omitted, the API assumes *. When the Qualified job name parameter is specified, all spooled files for the job that are found in the ASPs that are currently part of the caller's library name space are returned.



Format of the Generated List

The spooled file list consists of:

For details about the user area and generic header fields, see User spaces. For details about the remaining items, see the following subtopics. For descriptions of the fields in the list, see Field Descriptions.

When you retrieve list entry information from a user space, you must use the entry size returned in the generic header as a displacement to the next list entry. The size of each entry may be padded at the end. If you do not use the entry size, the result may not be valid.

Input Parameter Section (Optional Parameter Groups 1 and 2)

Note: This input parameter section format is used only when Optional Parameter Group 1 or Optional Parameter Group 2 is specified on the call to the QUSLSPL API. The order of the fields in the input parameter section does not match the order of the parameters on the call to the API.


Input Parameter Section 2 (Optional Parameter Group 3, 4, and 5)

Note: This input parameter section format is used only when Optional Parameter Group 3, 4, or 5 is specified on the call to the QUSLSPL API. This input parameter section is used if optional parameter group 3, 4, or 5 is specified on the call to the API. The order of the fields in the input parameter section does not match the order of the parameters on the call to the API.


Header Section



Format SPLF0100



Format SPLF0200



Valid Keys



Format SPLF0300



Format SPLF0400



Field Descriptions

Auxiliary storage pool. The auxiliary storage pool in which the spooled file resides.

Valid values are:


Auxiliary storage pool device name. The name of the auxiliary storage pool device in which the spooled file resides.

Valid values are:


Auxiliary storage pool device name specified. The auxiliary storage pool device name specified in the call to the API.


Auxiliary storage pool specified. The auxiliary storage pool specified in the call to the API.

Copies left to produce. The remaining number of copies to be produced on the writer. This attribute applies to printer device type spooled files only.

Current page. The page number or record number currently being written. The page number may be lower or higher than the page number actually being printed because of buffering done by the system. For example, if the spooled file is routed to a diskette unit or the writer is currently printing job separators or file separators for the spooled file, the page number shown may be zero.

Data. The data returned for the key field.

Date file last used. The date, based on local job time, that the file was last used in the CYYMMDD format.

Date file was created in UTC. The date, based on Coordinated Universal Time (UTC), that the file was opened in the CYYMMDD format.

Date file was opened (created). The date, based on local job time, that the file was opened in the CYYMMDD format.

Device. The name of the device on which the spooled file is located. If the spooled file is on an output queue that is the default output queue of a printer, this field contains the name of the output queue. Otherwise, this field is blank.

Device type. The type of device for which the spooled file is intended. The possible values are PRINTER or DISKETTE.

Ending spooled file create date specified. The spooled file create date specified in the call to the API.

Ending spooled file create date used. The spooled file create date used by the API to generate the list of spooled files.

Ending spooled file create time specified. The spooled file create time specified in the call to the API.

Ending spooled file create time used. The spooled file create time used by the API to generate the list of spooled files.

Form type. The type of form to load in the printer to print this file. This attribute applies to printer device type spooled files only.

Format name. The format of the retrieved output.

Job name. The name of the job that owns the spooled file.

Job number. The number of the job that owns the spooled file.

Job system name. The name of the system where the job that created the spooled file ran.

Job system name specified. The name of the system where the qualified job, specified in the call to the API, was run.

Key field for field returned. The identifier of the field returned. See Valid Keys for a list of valid keys. The fields in the list data section are returned in the order specified by the key fields specified parameter for each spooled file in the list.

Key fields specified. The list of fields to return in the SPLF0200 format specified in the call to the API.

Internal job identifier. The internal identifier for the job. Only the IBM® i APIs use this identifier, not any other interface on the system. The identifier is not valid following an initial program load (IPL). If you attempt to use it after an IPL, an exception occurs. This identifier is always valid when used with the internal spooled file identifier as input to IBM i APIs. For spooled files which have been detached from their jobs or which are on independent disk pools, this value is not valid as input to some IBM i APIs, such as the Retrieve Job Information (QUSRJOBI) API, that take this value without the internal spooled file identifier.

Internal spooled file identifier. The input value that other programs use to improve the performance of locating the spooled file on the system. Only the spooled file APIs use this identifier, not any other interface on the system. The identifier is not valid following an initial program load (IPL) or if the spooled file has been moved between auxiliary storage pools (ASPs). If you attempt to use an invalid internal spooled file identifier, an exception occurs.

Internet print protocol job identifier. The IPP job identifier assigned by the system based on the output queue to which the file was added or moved. This value ranges from 1 to 2147483647 and is not guaranteed to be unique for a given output queue.

Length of data returned. The length of the data returned for the field.

Length of field information returned. The total length of information returned for this field.

Number of fields returned. This is the number of fields returned to the application.

Number of key fields specified. The number of fields to return in format SPLF0200 specified in the call to the API.

Offset to key fields specified. The offset to the keys of the fields to be returned that is specified in the call to the API.

Output queue library name specified. The name of the output queue library specified in the call to the API.

Output queue library name. The library where the output queue is located.

Output queue name specified. The name of the output queue specified in the call to the API.

Output queue name. The name of the output queue in which the file is located.

Priority. The priority of the spooled file. The priority ranges from 1 (highest) to 9 (lowest).

Qualified job name specified. The qualified name of the job specified in the call to the API.

Qualified job name. The qualified name of the job that owns the spooled files.

Qualified job system name. The name of the system the qualified job was run on.

Reserved. The field is reserved.

Size of spooled file. The spooled file size. Multiply this field by the spooled file size multiplier field to get the size of the spooled file in number of bytes. The spooled file size is the data stream size plus the "overhead" storage used to store the spooled file's data stream, which includes the spooled file's attributes.

Spooled file name. The name of the spooled file in the list entry.

Spooled file number. The number of the spooled file in the list entry.

Spooled file schedule. The schedule of the spooled file.

Valid values are:

Spooled file size multiplier. This value must be multiplied by the size of spooled file field to get the size of the spooled file in number of bytes.

Spooled file status. The status of the file. The following list of values is used to describe the status of the file:


Spooled file system name. The name of the system where the job that created the spooled file ran.

Starting spooled file create date specified. The spooled file create date specified in the call to the API.

Starting spooled file create date used. The spooled file create date used by the API to generate the list of spooled files.

Starting spooled file create time specified. The spooled file create time specified in the call to the API.

Starting spooled file create time used. The spooled file create time used by the API to generate the list of spooled files.

Status. The status of the file. The following list of values is used to describe the status of the file:

Time file was created in UTC. The time, in Coordinated Universal Time (UTC), that the file was opened in the HHMMSS format.


Time file was opened (created). The time, in local job time, that the file was opened in the HHMMSS format.


Total pages. The number of pages this printer file contains or the number of records this diskette file contains.

Type of data. The type of data returned.


User name. The name of the user that owns the spooled file.

User name specified. The name of the user specified in the call to the API.

User space library name. The library containing the user space.

User space library name specified. The library name of the user space specified.

User space name. The name of the user space that contains the format returned.

User space name specified. The name of the user space specified.

User-specified data. The 10 characters of user-specified data that describe the file.


Error Messages


API Introduced: V1R3

[ Back to top | Print APIs | APIs by category ]