CPYSPLF (Copy Spooled File)
CPYSPLF Command syntax diagram
Purpose
The Copy Spooled File (CPYSPLF) command copies the data records in the specified spooled file to a user-defined physical data-base file. This conversion allows the use of spooled files in applications using microfiche, data communications, or data processing. Print lines that are all blank are not copied.
When you copy a spooled file to a physical file, certain information is lost or changed, including:
- Graphics data is lost.
- Bar code data is lost.
- Data defined by using the DFNCHR or TRNSPY keywords is replaced with blanks.
- Translation for CHRID and TRNTBL is not performed. (CHRID and TRNTBL are specified through DDS and printer device file parameters.)
If the CPYF command is used to copy the data back to another spooled file, additional information is lost, including:
- For printer files, any attribute that varied within the spooled file. This includes variable CPI, variable LPI, variable FONT, variable CHRID, variable PAGRTT, and variable DRAWER. The entire file is produced with the values specified by the file level attributes. Also, any subscripts, superscripts, or justification of text is lost. Text prints in the default color of the device.
- Any file level attributes (CODE, EXCHTYPE, LABEL, and VOL for diskette files; CHRID, CPI, DEVTYPE, DRAWER, FONT, FORMFEED, PAGESIZE, LPI, PAGRTT, and PRTQLTY for printer files) are set from the device file specified by the TOFILE parameter on the CPYF command. To make the new spooled file look as much like the original spooled file as possible, the attributes of the device file should be overridden to have the same values as the original spooled file. The attributes of the original spooled file can be obtained by using the Work with Spooled File Attributes (WRKSPLFA) command.
Required Parameters
- FILE
- Specifies the name of the spooled file that is copied to a database file.
- TOFILE
- Specifies the qualified name of the file that receives the copied records.
Note: If this file does not exist at the time of copy operation is specified, the copy operation fails. The name of the file can be qualified by one of the following library values:
*LIBL: All libraries in the job's library list are searched until the first match is found.
*CURLIB: The current library for the job is searched. If no library is specified as the current library for the job, the QGPL library is used.
library-name: Specify the name of the library to be searched.
database-file-name: Specify the name of the database file to which the spooled records are copied.
Optional Parameters
- JOB
- Specifies the name or qualified name of the job that created the spooled file whose data records are to be copied. More information on this parameter is in Commonly used parameters.
*: The job that issued this CPYSPLF command is the job that created the spooled file. If no job qualifier is given, all of the jobs currently in the system are searched for the simple job name.
job-name: Specify the name of the job that created the spooled file.
user-name: Specify the name of the user of the job that created the spooled file.
job-number: Specify the number of the job that created the spooled file.
- SPLNBR
- Specifies the number of the spooled file from the job whose data records are to be copied. More information on this parameter is in Commonly used parameters.
*ONLY: One spooled file from the job has the specified file name. The number of the spooled file is not necessary. If *ONLY is specified and more than one spooled file has the specified file name, a message is sent.
*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. Use this value when the job system name parameter or the spooled file creation date and time parameter is to take precedence over the spooled file number when selecting a spooled file.>
spooled-file-number: Specify the number of the spooled file whose data records are copied.
- JOBSYSNAME
- Specifies 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.
*ONLY: There is one spooled file with the specified job name, user name, job number, spooled file name, spooled file number, and spooled file creation 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 creation 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 creation date and time parameter is to take precedence over the job system name when selecting a spooled file.
system name: Specify the name of the system where the job which created the spooled file ran.
- CRTDATE
- Specifies 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.
*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 creation date and time of the specified job name, user name, job number, spooled file name, spooled file number, and job system name is used.
Element 1: Date spooled file was created
date: Specify the date the spooled file was created.
Element 2: Time spooled file was created
*ONLY: 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 creation date.
*LAST: The spooled file with the latest creation time of the specified job name, user name, job number, spooled file name, spooled file number, job system name, and spooled file creation date is used.
time: Specify the time the spooled file was created.
- TOMBR
- Specifies the name of the file member that receives the copied records.
*FIRST: The first member in the physical file receives the copied records.
member-name: Specify the member name of the physical file. If this member does not exist, a member with the specified name is created and the copy operation continues.
- MBROPT
- Specifies whether the new records replace or are added to the existing records.
*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
- Specifies to replace the internal print control characters, if any, of a spooled file. Any invalid internal print control characters that are encountered are ignored and formatting may be unpredictable.
*NONE: No print control characters are created. This option is required for diskette. This option may be useful for microfiche production.
ANSI First-Character Forms-Control Codes
- Code
- Action before Printing a Line
- ' '
- Space one line (blank code)
- 0
- Space two lines
- -
- Space three lines
- +
- Suppress space
- 1
- Skip to next channel 1
- 2
- Skip to next channel 2
- 3
- Skip to next channel 3
- 4
- Skip to next channel 4
- 5
- Skip to next channel 5
- 6
- Skip to next channel 6
- 7
- Skip to next channel 7
- 8
- Skip to next channel 8
- 9
- Skip to next channel 9
- A
- Skip to next channel 10
- B
- Skip to next channel 11
- C
- Skip to next channel 12
*FCFC: The first character of every record contains an American National Standards Institute (ANSI) forms control character. If *FCFC is specified, the record length must include one extra position for the first-character forms-control code. This value is not valid for externally described printer files.
*PRTCTL: Specifies that the first four characters of every record contains skip- and space-before values useful in HLL (high-level language) programs. This code can be viewed as SSSL, where SSS is the skip-before line value and L is the space-before value. SSS can range from 001 through 255 to cause a skip to the specified line. Once there, L can be used to specify a spacing of 0, 1, 2, or 3 lines before printing of the record begins. When one part of the code is used (SSS or L), the other part is left blank.
Note: Skip-before line values less than three will not be copied to the to-file; however, they will cause a skip of the specified number of lines. All space-before characters will be copied in the to-file. Sample control codes and their meanings follow:
- Code
- Action before Printing a Line
- '001 '
- Skip to line 1
- '010 '
- Skip to line 10
- '099 '
- Skip to line 99
- ' 1'
- Space one line
- ' 0'
- Do not space (or skip)
*S36FMT: The format of the records copied to a database file is the same as that created by $UASF on the IBM System/36 for COPYPRT. Only spooled printer files can be copied when *S36FMT is specified.
The first record placed in the database file for each spooled file being copied is a header record. Table 1 shows the format for these header records. Columns that are not defined must be blank.
The 2-byte binary numbers are unsigned. That means a page number of 65535 is the highest page number in a header or data record. When the actual page number is higher than 65535, the page numbering wraps beyond 65535 to 0, and then proceeds to 1, 2, 3, and so on.
- CHLVAL
- Specifies a list of channel numbers with their assigned line numbers. Specify this parameter only if CTLCHAR(*FCFC) has been specified. If the spooled file to be printed has data on a line that immediately precedes a line number assigned to a channel, the copy operation ends.
*NORMAL: Indicates channel 1 is the only assigned channel number. The assigned line number for channel 1 is line 1.
Element 1: Channel Numbers
channel-number: Specify which ANSI FCFC channels are used to create first-character forms control codes. The only valid values for this parameter range from 1 through 12. Each channel number may be specified only once per CPYSPLF command.
Element 2: Line Numbers
line-number: Specify the line number assigned for the channel number in the same list. Valid line numbers range form 1 through 255. Each line number may be specified only once per CPYSPLF command.
Notes
- The order in which the channels are specified on the command is not important. For example, the following lines would be identical:
- CHLVAL((2 1)(6 15)(8 40))
- CHLVAL((6 15)(2 1)(8 40))
- Channel numbers and line numbers do not have to be specified in ascending order.
Beginning Column Field Length Contents or Description 1 1 The letter H (to indicate the header) 4 6 The spooled file ID of the entry 12 8 The procedure name 22 8 The job name (the last two characters of the name are truncated) 32 8 The user ID of spooled file creator (the last two characters of the ID are truncated) 42 8 The printer file name (the last two characters of the name are truncated) 52 2 The System/36 printer ID that corresponds to the device that the file prints on. The printer ID shown is the ID for the System/36 environment that copies the file, not the environment that opened the spooled file. 56 4 The forms number (the first 4 characters of the form type of the spooled file) 61 2 The number of copies (in binary) 65 2 The number of pages (in binary) 69 4 The number of data records (in binary) which follow this header record 74 2 The number of lines per page (in binary) 78 1 The letter I if this entry contains print records with double-byte character set (IGC or DBCS) data 81 1 The letter M if this entry contains print records with a length greater than 132 84 1 Lines per inch (in binary) 85 1 Characters per inch (in binary) 86 1 Font ID (in binary)1 87 1 Justify2 88 1 Align3 89 2 The maximum length of the print lines in the spooled file that was copied 92 10 The user name (not truncated) of the creator of the of the spooled file 102 10 The printer file name (not truncated) 112 10 The form type (not truncated) 122 1 The letter Y if this is a copy of a document originally created by DisplayWrite* 123 2 The page width of the DisplayWrite document in 1440ths of an inch (in binary) 125 2 The page length of the DisplayWrite document in 1440ths of an inch (in binary) 127 2 The line increment value (lines per inch) of the DisplayWrite document in 1440ths of an inch (in binary).
- 1
- The iSeries 400 Font printer file parameter is converted to a binary 1 field. The maximum font ID on IBM System/36 Operation Control Language (OCL) is 255, while iSeries 400 supports font identifiers above 255. When an iSeries 400 font ID above 255 is used, this field is set to X'0B' for Courier 11 font. If FONT(*CPI) is specified, the field contains X'00'.
- 2
- This is a percent of justification for 5219 printer files. Valid values are: X'00', X'32', and X'64'.
- 3
- Y means to align forms, and N means not to align forms.
The data records placed in the disk file for each copied spooled file have the following format:
Table 2. Copied Spooled File Format
Beginning
ColumnField
Length
Contents or Description1 2 The page number (in binary) 3 2 The line number (in binary) 5 4 The record number (in binary) 9 1 The letter I if this print record contains double-byte character set (IGC or DBCS) data 10 1 A double-byte character set (DBCS or IGC) shift-out character (hexadecimal 0E) if this print record starts with DBCS data 11 nnn The data to be printed1
- 1
- The field length is the file record length minus 10. If the print data is too long, it is truncated, and if it is too short, it is padded with blanks. The format of data may not precisely match the format that is produced on IBM System/36 when multiple prints are used to construct a single print line.
Examples for CPYSPLF
Example 1: Replacing Data
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). The newly copied data replaces all old data in the member because all old records have been cleared. The 4-byte print control code is created.
Example 2: Adding Data
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. The FCFC 1-byte print control character is used and takes advantage of the assigned channel values in formatting the output. The assigned channel values as specified on the command are as follows:
- Line 3 assigned to channel 1
- Line 15 assigned to channel 4
Error messages for CPYSPLF
*ESCAPE Messages
- CPF2207
- Not authorized to use object &1 in library &3 type *&2.
- CPF3207
- Member not added. Errors occurred.
- CPF3303
- File &1 not found in job &5/&4/&3.
- CPF3309
- No files named &1 are active.
- CPF3311
- Copy request failed for file &6 in &7.
- CPF3330
- Necessary resource not available.
- CPF3340
- More than one file with specified name found in job &5/&4/&3.
- CPF3342
- Job &5/&4/&3 not found.
- CPF3343
- Duplicate job names found.
- CPF3344
- File &1 number &2 no longer in the system.
- CPF3394
- Cannot convert spooled file data.
- CPF3429
- File &1 number &2 cannot be displayed, copied, or sent.
- CPF3482
- Copy request failed. Spool file &1 is open.
- CPF3483
- Copy request failed for file &6 in &7.
- CPF3486
- CHLVAL parameter value not valid.
- CPF3492
- Not authorized to spooled file.
- CPF3493
- CTLCHAR parameter not correct for file &1.
- CPF3499
- Records in file &1 preceded all assigned channel values.
- CPF5812
- Member &3 already exists in file &1 in library &2.
- CPF9812
- File &1 in library &2 not found.
- CPF9837
- Attempt made to override file &1 to MBR(*ALL).
- CPF9845
- Error occurred while opening file &1.
- CPF9846
- Error while processing file &1 in library &2.