Command reference / spool

CPYSPLF

Copy Spooled File

Copies the records in a spooled file to a physical file member or an IFS stream file.

Allowed environments: *ALL. Positional parameters: 2.

Parameters

FILE Spooled file

Sets the spooled file that is to be copied to a database file or stream file.

Type
*NAME
Required
Yes
Length
10
Case
Uppercase
name
Enter the file name of the spooled file.

TOFILE To data base file

Controls whether the spooled file's records will be copied to a user-defined physical database file or a stream file. If the user specifies the name of a database file and the file does not exist at the time of the copy, the copy will fail.

Type
*QUAL
Required
Yes
Case
Uppercase

Suggested / special values: *TOSTMF

*TOSTMF
The spooled file will be converted based on the workstation customizing object specified in the Workstation customizing object (WSCST) parameter and the output placed in the stream file specified in the To stream file (TOSTMF) parameter.
name (to data base file)
Enter the file name of the physical file to receive the copy.
*LIBL
Look in the thread's library list.
*CURLIB
The current library for the job is used to locate the file. If no current library entry exists in the library list, QGPL is used.
name (library)
Enter the name of the library where the file is located.
Qualified parts (object, then library; write LIBRARY/OBJECT)

To data base file To data base file

Type
*NAME
Required
No
Length
10
Case
Uppercase

Library Library

Type
*NAME
Required
No
Default
*LIBL
Length
10
Case
Uppercase

Suggested / special values: *LIBL, *CURLIB

JOB Job name

Sets the job that created the spooled file whose data records are to be copied.

Type
*QUAL
Required
No
Default
*
Case
Uppercase

Suggested / special values: *

*
The job that issued this command is the job that created the spooled file.
name (job name)
Enter the name of the job that created the spooled file.
name (user)
Enter the user name that identifies the user profile under which the job is run.
000000-999999
Enter the system-assigned job number.
Qualified parts (object, then library; write LIBRARY/OBJECT)

Job name Job name

Type
*NAME
Required
No
Length
10
Case
Uppercase

User User

Type
*NAME
Required
No
Length
10
Case
Uppercase

Number Number

Type
*CHAR
Required
No
Length
6
Case
Uppercase

SPLNBR Spooled file number

Sets the number of the spooled file, from the job whose data records are to be copied.

Type
*INT4
Required
No
Default
*ONLY
Range
1 to 999999
Case
Uppercase

Suggested / special values: *ONLY, *LAST, *ANY

*ONLY
Only one spooled file in the job has the specified file name; therefore, the number of the spooled file is not necessary.
*LAST
The spooled file with the highest number and the specified file name is used.
*ANY
The spooled file number is not used to determine which spooled file is used.
1-999999
Enter the number of the spooled file whose data records are to be copied.

JOBSYSNAME Job system name

Enter the name of the system where the job that created the spooled file (JOB parameter) ran. This parameter is considered after the job name, user name, job number, spooled file name, and spooled file number parameter requirements have been met.

Type
*NAME
Required
No
Default
*ONLY
Length
10
Case
Uppercase

Suggested / special values: *ONLY, *CURRENT, *ANY

*ONLY
There is one spooled file with the specified job name, user name, job number, spooled file name, spooled file number, and spooled file create date and time.
*CURRENT
The spooled file created on the current system with the specified job name, user name, job number, spooled file name, spooled file number, and create date and time is used.
*ANY
The job system name is not used to determine which spooled file is used. Use this value when the spooled file create date and time parameter is to take precedence over the job system name when selecting a spooled file.
name
Enter the name of the system where the job that created the spooled file ran.

CRTDATE Spooled file created

Sets the date and time the spooled file was created. This parameter is considered after the job name, user name, job number, spooled file name, spooled file number, and job system name parameter requirements have been met.

Type
*ELEM
Required
No
Default
*ONLY
Case
Uppercase

Suggested / special values: *ONLY, *LAST

*ONLY
There is one spooled file with the specified job name, user name, job number, spooled file name, spooled file number, and job system name.
*LAST
The spooled file with the latest create date and time of the specified job name, user name, job number, spooled file name, spooled file number, and job system name is used.
date
Enter the date the spooled file was created.
*ONLY (creation time)
There is one spooled file with the specified job name, user name, job number, spooled file name, spooled file number, job system name, and spooled file create date.
*LAST (creation time)
The spooled file with the latest create time of the specified job name, user name, job number, spooled file name, spooled file number, job system name, and spooled file create date is used.
time
Enter the time the spooled file was created.
Elements in order

Creation date Creation date

Type
*DATE
Required
No
Case
Uppercase

Creation time Creation time

Type
*TIME
Required
No
Default
*ONLY
Case
Uppercase

Suggested / special values: *ONLY, *LAST

TOMBR To member

Enter the name of the file member that receives the copied records.

Type
*NAME
Required
No
Default
*FIRST
Length
10
Case
Uppercase

Suggested / special values: *FIRST

*FIRST
The first member of the specified file is used.
name
Enter the name of the member of the physical file. If this member does not exist, a member is created and the copy continues.

MBROPT Replace or add records

Controls whether the new records replace or are added to the existing records.

Type
*CHAR
Required
No
Default
*REPLACE
Length
8
Case
Uppercase

Allowed values: *REPLACE, *ADD

*REPLACE
The system clears the existing member and adds the new records.
*ADD
The system adds the new records to the end of the existing records.

CTLCHAR Control character

Select which print control characters (if any) are to replace the spooled file's internal print control characters. This parameter is ignored if the Workstation customizing object (WSCST) parameter is specified and is not *NONE.

Type
*CHAR
Required
No
Default
*NONE
Length
7
Case
Uppercase

Allowed values: *NONE, *FCFC, *PRTCTL, *S36FMT

*NONE
No print control characters are created.
*FCFC
Sets that the first character of every record contains one of the ANSI forms control codes. This option may be useful for microfiche production.
*PRTCTL
Sets that the first four characters of every record contains skip- and space-before values useful in high-level language programs.
*S36FMT
Sets that the format of the records to be copied to a database file is the same as that created on the IBM System/36 for COPYPRT. This value is not allowed for spooled files which exist on primary or secondary auxiliary storage pools.

CHLVAL Channel values

Sets a list of channel numbers with their assigned line numbers. Specify this parameter only if *FCFC is specified on the Control character (CTLCHAR) parameter). Channel number refers to a method of determining skipping for reports. Each assigned channel must have a corresponding line number to provide the correct positioning on a report.

Type
*ELEM
Required
No
Default
*NORMAL
List limit
12
Case
Uppercase

Suggested / special values: *NORMAL

*NORMAL
Indicates channel 1 is the only assigned channel number. The assigned line number for channel 1 is line 1.
channel-number
Enter which channels are used to control skipping on a report. The only valid values for this parameter are 1 through 12. Each channel number can be specified only once per Copy Spooled File (CPYSPLF) command.
1-255
The line number assigned for the channel number in the same list. The range of valid line numbers is 1 through 255. Each line number can be specified only once per Copy Spooled File (CPYSPLF) command.
Elements in order

Channel Channel

Type
*CHAR
Required
No
Length
256
Case
Uppercase

Line Line

Type
*INT4
Required
No
Range
1 to 255
Case
Uppercase

TOSTMF To stream file

Sets the stream file where the output data is to be written. All directories in the path name must exist. New directories are not created. This parameter must specify a value other than *NONE if the To data base file (TOFILE) parameter is *TOSTMF.

Type
*PNAME
Required
No
Default
*NONE
Length
5000
Case
Uppercase

Suggested / special values: *NONE

*NONE
The output is written to a user-defined physical file. This value is only valid if the To data base file (TOFILE) parameter specifies a user-defined physical database file.
path-name
Enter the path name for the stream file where the output data is to be written. This value is only valid if the To data base file (TOFILE) parameter specifies *TOSTMF.

WSCST Workstation customizing object

Sets the workstation customizing object to use to transform the spooled file output to final form before writing it to a stream file. If the To data base file (TOFILE) parameter specifies a physical database file, the WSCST parameter is ignored.

Type
*QUAL
Required
No
Default
*NONE
Case
Uppercase

Suggested / special values: *NONE, *PDF

*NONE
Sets that no workstation customizing object is to be used.
*PDF
The output is transformed to Portable Document Format (PDF) before it is written into a stream file. If the stream file does not exist, the CCSID associated with the stream file will be set to 65535.
name (workstation customizing object)
Enter the name of the customizing object. When a named customizing object is used and the stream file does not exist, the CCSID associated with the stream file will be set to 65535.
*LIBL
Look in the thread's library list.
*CURLIB
The current library for the job is used to locate the customizing object. If no current library entry exists in the library list, QGPL is used.
name (library)
Enter the name of the library where the customizing object is located.
Qualified parts (object, then library; write LIBRARY/OBJECT)

Workstation customizing object Workstation customizing object

Type
*NAME
Required
No
Length
10
Case
Uppercase

Library Library

Type
*NAME
Required
No
Default
*LIBL
Length
10
Case
Uppercase

Suggested / special values: *LIBL, *CURLIB

STMFOPT Stream file option

Controls whether the copy operation replaces or fails to copy the records to the stream file if a stream file with the specified name already exists. If the stream file does not exist, it is created.

Type
*CHAR
Required
No
Default
*NONE
Length
8
Case
Uppercase

Allowed values: *NONE, *REPLACE

*NONE
No records are copied and the operation will fail.
*REPLACE
The records replace the existing stream file records.

OPNSPLF Copy open spooled file

Controls whether the copy operation is allowed to proceed if the spooled file specified in the FILE parameter is still open.

Type
*CHAR
Required
No
Default
*NO
Length
4
Case
Uppercase

Allowed values: *NO, *YES

*NO
No records are copied if the spooled file is open, and the copy will fail.
*YES
A diagnostic message is issued if the spooled file is open, and the records are copied.

Examples

CPYSPLF FILE(QPRINT) JOB(PAYROLL01) SPLNBR(4) TOFILE(MYFILE) TOMBR(MYMBR) CTLCHAR(*PRTCTL)

In this example, file QPRINT (which is the fourth file produced by job PAYROLL01) is copied to member MYMBR of physical file MYFILE (which resides in a library found by searching the library list).

CPYSPLF FILE(QPRINT) TOFILE(MYLIB/MYFILE) JOB(PAYROLL02) MBROPT(*ADD) CTLCHAR(*FCFC) CHLVAL((1 3) (4 15))

In this example, file QPRINT (the only file of that name left in job PAYROLL02) is copied to the first member of the physical file found in library MYLIB. The newly copied data is added to data existing in the member.

CPYSPLF FILE(EMAIL) JOB(123456/BARON/EMAIL01) SPLNBR(1) TOFILE(*TOSTMF) TOSTMF('/emailpdfs/email01.pdf') WSCST(*PDF) STMFOPT(*REPLACE)

In this example, spooled file EMAIL (which is the first spooled file produced by job 123456/BARON/EMAIL01) is converted to a PDF and stored in directory '/emailpdfs' with the name email01.pdf where it can be used by another application.

CPYSPLF FILE(MYDOC) JOB(*) SPLNBR(*LAST) TOFILE(*TOSTMF) TOSTMF(mydoc.afp) WSCST(*NONE) STMFOPT(*NONE)

In this example, the last spooled file named MYDOC produced by the current job is copied without conversion to a stream file named 'mydoc.afp' in the current working directory. The spooled file has a DEVTYPE of *AFPDS.

CPYSPLF FILE(MYDOC) JOB(*) SPLNBR(*LAST) TOFILE(*TOSTMF) TOSTMF(/textfiles/mydoc.txt) WSCST(QSYS/QWPDEFAULT)

In this example, the last spooled file named MYDOC produced by the current job is converted to ASCII text and placed in the directory '/textfiles' with the file name 'mydoc.txt'. The spooled file has a DEVTYPE of *SCS.

IBM command documentation

Generated from os/cl/catalog/CPYSPLF.json and os/cl/help/CPYSPLF.json.