Move Spooled File (QSPMOVSP) API


  Required Parameter Group:

1 Function information Input Char(*)
2 Length of function information Input Binary(4)
3 Function information format name Input Char(8)
4 Error code I/O Char(*)

  Default Public Authority: *USE

  Threadsafe: No

The Move Spooled File (QSPMOVSP) API can:

The spooled files can be identified by:

See Spooled File Identifying Fields for these combinations for spooled file identifiers.

Using this API, a spooled file can:


Restrictions for Movement of Spooled Files

Situations exist in which the QSPMOVSP API does not allow a spooled file to be moved.

These situations are:


Authorities and Locks

Output Queue of Spooled File Being Moved
*EXCLRD
New Output Queue of File Being Moved
*EXCLRD
Output Queue Library Authority
*EXECUTE

Output Queue Authorities

When the source spooled file moves to a different output queue and the source output queue is defined with DSPDATA(*OWNER), the requester must be the owner of the source spooled file or have *SPLCTL authority.

One or more of the following conditions must be met to move a spooled file on the destination output queue. The destination queue can be either the source output queue or a different output queue.


Spooled File Authorities

The requester is authorized to the source spooled file if one or more of the following conditions are met:


User Profile Highest Schedule Priority

When the requester has no other special authorities, the following are also in effect:

Special authorities of *JOBCTL (job control) and *SPLCTL (spool control) allow the requester to move a spooled file anywhere on an output queue.


Required Parameter Group

Function information
INPUT; CHAR(*)

The information that is associated with the spooled file to be moved and the output queue to which it is to be moved. See Format of the Function Information for the format of this parameter.

Length of function information
INPUT; INARY(4)

The length of the function information in the function information parameter. The length depends on the function format. Each format has a different (but fixed) length as shown in the specific format tables. The valid length for format MSPF0100 is 92 bytes or 114 bytes; the valid length for format MSPF0200 is 144 bytes or 188 bytes. If a valid length is not specified, message CPF3C1D will be issued.

Function information format name
INPUT; CHAR(8)

The format of the function information that is being provided. The information is provided in the function information parameter.

The formats are:

MSPF0100 Format for the function of *NEXT, which is a move of the source spooled file ahead of all other ready spooled files on the target output queue.
MSPF0200 Format for the function of *AFTER, which is a move of the source spooled file after the target spooled file.

Error code
I/O; CHAR(*)

The structure in which to return error information. For the format of the structure, see Error Code Parameter.


Format of the Function Information

MSPF0100 Format

The following table shows the information provided for the MSPF0100 format. For more details about the fields in the following table, see Field Descriptions.

Offset Type Field
Dec Hex
0 0 CHAR(10) Source job name
10 A CHAR(10) Source job user name
20 14 CHAR(6) Source job number
26 18 CHAR(16) Source internal job identifier
42 2A CHAR(16) Source internal spooled file identifier
58 3A CHAR(10) Source spooled file name
68 44 BINARY(4) Source spooled file number
72 48 CHAR(10) Target output queue name
82 52 CHAR(10) Target output queue library name
92 5C CHAR(8) Source job system name
100 64 CHAR(7) Source spooled file create date
107 6B CHAR(1) Reserved
108 6C CHAR(6) Source spooled file create time


MSPF0200 Format

The following table shows the information provided for the MSPF0200 format. For more details about the fields in the following table, see Field Descriptions.

Offset Type Field
Dec Hex
0 0 CHAR(10) Source job name
10 A CHAR(10) Source job user name
20 14 CHAR(6) Source job number
26 18 CHAR(16) Source internal job identifier
42 2A CHAR(16) Source internal spooled file identifier
58 3A CHAR(10) Source spooled file name
68 44 BINARY(4) Source spooled file number
72 48 CHAR(10) Target job name
82 52 CHAR(10) Target job user name
92 5C CHAR(6) Target job number
98 62 CHAR(16) Target internal job identifier
114 72 CHAR(16) Target internal spooled file identifier
130 82 CHAR(10) Target spooled file name
140 8C BINARY(4) Target spooled file number
144 90 CHAR(8) Source job system name
152 98 CHAR(7) Source spooled file create date
159 9F CHAR(1) Reserved
160 A0 CHAR(6) Source spooled file create time
166 A6 CHAR(8) Target job system name
174 AE CHAR(7) Target spooled file create date
181 B5 CHAR(1) Reserved
182 B6 CHAR(6) Target spooled file create time

Field Descriptions

Source internal job identifier. The internal identifier for the job that owns the spooled file to be moved. Only i5/OS APIs use this identifier; no other interface on the system does.

Note: The identifier is not valid following an initial program load (IPL). If you attempt to use it after an IPL, an exception occurs.

This field must be blank when the source job name is given.

Use one of the following APIs to make the identifier available:

There may be a performance advantage when identifying the source job by its internal identifier.

Source internal spooled file identifier. The internal identifier for the spooled file to be moved. Only the i5/OS APIs use this identifier; no other interface on the system does.

Note: The identifier is not valid following an initial program load (IPL). If you attempt to use it after an IPL, an exception occurs.

This field must be blank when a source spooled file name is given.

Use one of the following APIs to make the identifier available:

There may be a performance advantage when identifying the source spooled file by its internal identifier.

Source job name. The name of the job that owns the spooled file to be moved.

The possible values are:

* Only the job that this program is running. The job user name, job number, and internal identifier for the source job must be blank.
*INT The job to be moved is identified by the internal job identifier.
Name The name of the job that owns the spooled file to be moved.

Source job number. The number of the job that owns the spooled file to be moved. It can optionally be blank when a job name or a job user name is specified. This field must be blank when the source job name is specified as *INT or *.

Source job system name. The name of the system where the job that created the source spooled file ran or blank when the source spooled file name is *INT. This field is considered after the source job name, source user name, source job number, source spooled file name, and source spooled file number field requirements have been met.

The possible values are:

*ONLY There is one job with the specified source job name, source job user name, source job number, source spooled file name, source spooled file number, source spooled file creation date, and source spooled file creation time.
*CURRENT The job on the current system with the specified source job name, source job user name, source job number, source spooled file name, source spooled file number, source spooled file create date, and source spooled file create time is used.
*ANY The source job system name is not considered when selecting a spooled file. Use this value when you want the source spooled file create date and source spooled file create time fields to take precedence over the source job system name when selecting a spooled file.
system-name The name of the system where the job that created the source spooled file ran.

When the Length of function information parameter is less than 114 with format MSPF0100 or less than 188 with format MSPF0200, the API assumes blanks when the source spooled file name is *INT. When source spooled file name is not *INT, the API assumes *ONLY.

Source job user name. The user name of the job that owns the spooled file to be moved. It can optionally be blank when a job name is specified. This field must be blank when the source job name is specified as *INT or *.

Source spooled file create date. The date the source spooled file was created on the system or blank when the spooled file name is *INT. This field is considered after the source job name, source job user name, source job number, source spooled file name, source spooled file number, and source job system name field requirements have been met. The date must be in the CYYMMDD format or one of the following special values:

*ONLY There is only one spooled file with the specified source job name, source user name, source job number, source spooled file name, source spooled file number, and source job system name.
*LAST The spooled file with the latest date and time which also has the specified source job name, source job user name, source job number, source spooled file name, source spooled file number, and source job system name is used.
date The date the source spooled file was created on the system in the format CYYMMDD. See field Date file opened in API QUSRSPLA under field descriptions for more information on the date format.

When the Length of function information parameter is less than 114 with format MSPF0100 or less than 188 with format MSPF0200, the API assumes blanks when the spooled file name is *INT. When spooled file name is not *INT, the API assumes *ONLY.

Source spooled file create time. The time the source spooled file was created on the system or blank when the source spooled file name is *INT. This field must be set to blanks when special values *LAST or *ONLY are used for field source spooled file create date. This field must have a value set if a date is specified for field source spooled file create date. This field is considered after the source job name, source job user name, source job number, source spooled file name, source spooled file number, source job system name, and source spooled file create date field requirements have been met. The time must be in the HHMMSS format or one of the following special values:

*ONLY There is only one spooled file with the specified source job name, source job user name, source job number, source spooled file name, source spooled file number, source job system name, and source spooled file create date.
*LAST The spooled file with the latest time which also has the specified source job name, source user name, source job number, source spooled file name, source spooled file number, source job system name, and source spooled file create date is used.
time The time the source spooled file was created on the system in the format HHMMSS. See field Time file opened in API QUSRSPLA under field descriptions for more information on the time format.
blanks This field must be set to blanks if the Source spooled file create date field is set to *LAST or *ONLY.

When the Length of function information parameter is less than 114 with format MSPF0100 or less than 188 with format MSPF0200, the API assumes blanks for this field.

Source spooled file name. The name of the spooled file to be moved.

The possible values are:

*INT The source spooled file is identified by the internal spooled file identifier.
Name The name of the spooled file to be moved.

Source spooled file number. The unique number of the spooled file to be moved. The valid range is -1 through 999999 and must be specified as such even if the value for the spooled file name field is *INT.

The following special values are supported for this field:

0 Only one spooled file from the job has the specified file name; therefore, the number of the spooled file is not necessary.
-1 The highest-numbered spooled file with the specified file name.
-2 The source spooled file number is not used to determine which spooled file to process. Use this value when you want the source job system name field or the source spooled file create date and source spooled file create time fields to take precedence over the source spooled file number when selecting a spooled file.

Target internal job identifier. The internal identifier for the job of the spooled file after which the source spooled file is to be moved. Only the i5/OS APIs use this identifier; no other interface on the system does.

Note: The identifier is not valid following an initial program load (IPL). If you attempt to use it after an IPL, an exception occurs.

This field must be blank when a job name is given.

Use one of the following APIs to make the identifier available:

There may be a performance advantage when identifying the target job by its internal identifier.

Target internal spooled file identifier. The internal identifier for the spooled file after which the source spooled file is to be moved. Only the i5/OS APIs use this identifier; no other interface on the system does.

Note: The identifier is not valid following an initial program load (IPL). If you attempt to use it after an IPL, an exception occurs.

This field must be blank when a target spooled file name is given.

Use one of the following APIs to make the identifier available:

There may be a performance advantage when identifying the target spooled file by its internal identifier.

Target job name. The name of the job of the spooled file after which the source spooled file is to be moved.

The possible values are:

* Only the job that this program is running. The target job user name, target job number, and target internal identifier job must be blank.
*INT The target job is identified by the target internal job identifier.
Name The name of the job that owns the spooled file after which the source spooled file is to be moved.

Target job number. The number of the target job. This is the number of the job that owns the spooled file after which the source spooled file is to be moved. It can optionally be blank when a target job name or target job user name is specified. This field must be blank when the target job name is specified as *INT or *.

Target job system name. The name of the system where the job that created the target spooled file ran or blank when the target spooled file name is *INT. This field is considered after the target job name, target job user name, target job number, target spooled file name, and target spooled file number field requirements have been met.

The possible values are:

*ONLY There is one job with the specified target job name, target job user name, target job number, target spooled file name, target spooled file number, target spooled file creation date, and target spooled file creation time.
*CURRENT The job on the current system with the specified target job name, target job user name, and target job number is used.
*ANY The target job system name is not considered when selecting a spooled file. Use this value when you want the target spooled file create date and target spooled file create time fields to take precedence over the target job system name when selecting a spooled file.
system-name The name of the system where the job that created the target spooled file ran.

When the Length of function information parameter is less than 188, the API assumes blanks when the spooled file name is *INT. When spooled file name is not *INT, the API assumes *ONLY.

Target job user name. The user name of the target job. It can optionally be blank when a target job name is specified. This field must be blank when the target job name is specified as *INT or *.

Target output queue library name. The name of the library that contains the output queue.

The possible values are:

*LIBL The library list is used to locate the output queue.
*CURLIB The current library is used to locate the output queue. If no library is specified as the current library for the job, QGPL is used.
Name The library name.
blank No output queue library is specified when the output queue name is specified as *SAME.

Target output queue name. The name of the output queue to which the source spooled file is to move to the top of.

The possible values are:

*SAME The spooled file will move to the top of the output queue on which it currently resides.
Name The name of the specific output queue the spooled file is to move to the top of.

Target spooled file create date. The date the target spooled file was created on the system or blank when the target spooled file name is *INT. This field is considered after the target job name, target job user name, target job number, target spooled file name, target spooled file number, and target job system name field requirements have been met. The date must be in the CYYMMDD format or one of the following special values:

*ONLY There is only one spooled file with the specified target job name, target job user name, target job number, target spooled file name, target spooled file number, and target job system name.
*LAST The spooled file with the latest date and time which also has the specified target job name, target job user name, target job number, target spooled file name, target spooled file number, and target job system name is used.
date The date the target spooled file was created on the system in the format CYYMMDD. See field Date file opened in API QUSRSPLA under field descriptions for more information on the date format.

When the Length of function information parameter is less than 188, the API assumes blanks when the target spooled file name is *INT. When target spooled file name is not *INT, the API assumes *ONLY.

Target spooled file create time. The time the target spooled file was created on the system or blank when the target spooled file name is *INT. This field must be set to blanks when special values *LAST or *ONLY are used for field target spooled file create date. This field must have a value set if a date is specified for field target spooled file create date. This field is considered after the target job name, target job user name, target job number, target spooled file name, target spooled file number, target job system name, and target spooled file create date field requirements have been met. The time must be in the HHMMSS format or one of the following special values:

*ONLY There is only one spooled file with the specified target job name, target job user name, target job number, target spooled file name, target spooled file number, target job system name, and target spooled file create date.
*LAST The spooled file with the latest time which also has the specified target job name, target job user name, target job number, target spooled file name, target spooled file number, target job system name, and target spooled file create date is used.
time The time the target spooled file was created on the system in the format HHMMSS. See field Time file opened in API QUSRSPLA under field descriptions for more information on the time format.
blanks This field must be set to blanks if the Target spooled file create date field is set to *LAST or *ONLY.

When the Length of function information parameter is less than 188, the API assumes blanks for this field.

Target spooled file name. The name of the spooled file after which the source spooled file is to be moved.

The possible values are:

*INT The target spooled file is identified by the target internal spooled file identifier.
Name The name of the spooled file after which the source spooled file is to be moved.

Target spooled file number. The unique number of the spooled file after which the source spooled file is to be moved. The valid range is -1 through 999999 and must be specified as such even if the value for the spooled file name field is *INT. The following special values are supported for this field:

0 Only one spooled file from the job has the specified file name; therefor, the number of the spooled file is not necessary.
-1 The highest-numbered spooled file with the specified file name.
-2 The target spooled file number is not used to determine which spooled file to process. Use this value when you want the target job system name field or the target spooled file create date and target spooled file create time fields to take precedence over the target spooled file number when selecting a spooled file.

How to Specify Spooled File Identifying Fields

This table illustrates the valid field combinations of qualified job name, internal job identifier, internal spooled file identifier, spooled file name, spooled file number, job system name, spooled file create date, and spooled file create time. The combinations of these fields identify the spooled file to be moved and the spooled file it is to be moved after. For example, when the qualified job name field value is *, the internal job identifier must be blank, the internal spooled file identifier must be blank, the actual name of the spooled file must be given, and a valid spooled file number must be given.

Spooled File Identifying Fields

Qualified Job Name Internal Job Identifier Internal Spooled File Identifier Spooled File Name Spooled File Number Job System Name Spooled File Create Date Spooled File Create Time
Job Name User Name Job Number
Name Name Number Blanks Blanks Name -2 through 999999 Name, *ONLY, *CURRENT, or *ANY Date, *ONLY, or *LAST Time, blanks, *ONLY, or *LAST
Name Name Blanks Blanks Blanks Name -2 through 999999 Name, *ONLY, *CURRENT, or *ANY Date, *ONLY, or *LAST Time, blanks, *ONLY, or *LAST
Name Blanks Blanks Blanks Blanks Name -2 through 999999 Name, *ONLY, *CURRENT, or *ANY Date, *ONLY, or *LAST Time, blanks, *ONLY, or *LAST
* Blanks Blanks Blanks Blanks Name -2 through 999999 Name, *ONLY, *CURRENT, *ANY Date, *ONLY, or *LAST Time, blanks, *ONLY, or *LAST
*INT Blanks Blanks Internal job identifier Internal spooled file identifier *INT -1 through 999999 Blanks Blanks Blanks
*INT Blanks Blanks Internal job identifier Blanks Name -2 through 999999 Name, *ONLY, *CURRENT, or *ANY Date, *ONLY, or *LAST Time, blanks, *ONLY, or *LAST

See Notes for additional information.

Notes: This parameter combination is not valid when a job has been detached from its spooled files or for a spooled file on an independent disk pool. Use of this combination will result in message CPF3C43.


Error Messages

Message ID Error Message Text
CPF2207 E Not authorized to use object &1 in library &3 type *&2.
CPF24B4 E Severe error while addressing parameter list.
CPF3CF1 E Error code parameter not valid.
CPF3C1D E Length specified in parameter &1 not valid.
CPF3C21 E Format name &1 is not valid.
CPF3C33 E Spooled file number &1 is not valid.
CPF3C40 E Spooled file &4 not found.
CPF3C41 E More than one spooled file with same name.
CPF3C42 E User name or job number is not blank.
CPF3C43 E Internal job identifier is not valid.
CPF3C44 E Internal spooled file identifier is not valid.
CPF3C58 E Job name specified is not valid.
CPF3C90 E Literal value cannot be changed.
CPF33AA E Target spooled file &1 number &2 in job &5/&4/&3 in open status.
CPF33AB E Target spooled file &1 number &2 in job &5/&4/&3 in closed status.
CPF33AC E Spooled file &1 number &2 in job &5/&4/&3 in deferred status.
CPF33AD E Target spooled file &1 not last spooled file in ready status. Source spooled file not moved.
CPF33AE E Spooled file &1 number &2 in job &5/&4/&3 not moved.
Start of changeCPF33AF E Duplicate spooled file &1 number &2 in job &3/&4/&5 found.End of change
CPF33A6 E Spooled file &1 selected by writer. Spooled file not moved.
CPF33A8 E Spooled file &1 specified more than once. Spooled file not moved.
CPF33A9 E Target spooled file &1 changed output queue. Source spooled file not moved.
CPF33CA E Output queue &1 in library &2 is not valid.
CPF33CB E Priority required to move spooled file exceeds user's limit.
CPF33C2 E Moving spooled files to the top allowed only for output queues with SEQ(*FIFO).
CPF33C3 E Priority required to move spooled file exceeds user's limit.
CPF33C4 E Spooled file &1 held by HLDJOB command. Spooled file not moved.
CPF33C5 E Target spooled file &1 selected by writer. Source spooled file not moved.
CPF33C6 E Priority required to move file exceeds user's limit.
CPF33C7 E Cannot move file ahead of other users' files.
CPF33C9 E Spooled file name parameter cannot be blank.
CPF3309 E No files named &1 are active.
CPF3330 E Necessary resource not available.
CPF333B E Job system name is not valid.
CPF333C E Spooled file create date is not valid.
CPF333D E Spooled file create time is not valid.
CPF333E E Spooled file create time is not blank.
CPF333F E Job system name is not blank.
CPF3342 E Job &5/&4/&3 not found.
CPF3343 E Duplicate job names found.
CPF3344 E File &1 number &2 no longer in the system.
CPF335B E Spooled file create date is not blank.
CPF3410 E New output queue &1 in &2 not found.
CPF3492 E Not authorized to spooled file.
CPF8122 E &8 damage on library &4.
CPF8128 E &8 damage on output queue &4 in library &9.
CPF9872 E Program or service program &1 in library &2 ended. Reason code &3.
CPI33C2 I Spooled file &1 number &2 in job &5/&4/&3 not moved to position requested.


API introduced: V3R1
Top | Print APIs | APIs by category