The CPYSPLTXT command copies a spool file into a source member.
There are a few typical uses of this function:
** You can produce spooled output and copy it back into a text
member that you are creating for documentation. This can be
used for either system supplied spooled output (e.g. a
picture of a menu) or your own output.
You can specify options to truncate part of the printed
output, place a border around the output etc.
** If you have spooled output that needs minor corrections and
then reprinting, you may use this command with the
MODIFY(*YES) option. The spooled file is copied to a
temporary source member, SEU is invoked and then the data is
** Because of the ease in which this can be performed, there are
security and integrity considerations for your normal spooled
output. This function should only be used when the changes
will not impact your audit trail.
The maximum length source file (240 bytes) can be used for copying to
and is also used for the Modify option. The maximum print width for
re-printing is 232 positions.
Most of the existing attributes of the spooled file are copied to the
Command parameters *CMD
FILE The spooled file that you want to copy.
JOB The job name which contains the spooled file. An *
indicates the current job. A fully qualified job
name may be used.
TXTMBR The source member you want to copy the file to.
Records are added to the member. The default value
is SPL1 which if specified is either added to the
file or cleared before new records are added. See
the REPLACE parameter discussion for a name other
TXTFILE The qualified name of the text source file. The
default is *LIBL/QTXTSRC.
REPLACE Whether to replace the data in the member. The
default is *DFT which means that if the member
exists and is named SPL1, the member is cleared
before writing. If a name other than SPL1 is used,
the member is added to.
If the member exists and is not named SPL1,
REPLACE(*YES) will clear the data before adding
If the member does not exist, the parameter is
ignored and the member is added to the file and then
SPLNBR The spooled file number. This is the same
definition as on CPYSPLF. It defaults to *LAST
which differs from the CPYSPLF default of *ONLY.
*LAST is used to assist in those cases where you are
re-printing the same information and do not delete
old spooled files. *ONLY or a specific file number
may be specified.
MODIFY This controls which of the two uses you want to
make. The default is *NO meaning the spool file is
just copied to the text member. A *YES entry copies
the spool file to a temporary source file, invokes
SEU and then prints the modified source. The same
file name is used as the new file with USRDTA =
CPYSPLTXT. The original file will also exist (it is
When the *YES option is taken, 4 bytes of printer
control characters will appear in the first 4 bytes
of the record. These should not be changed unless
you want different skipping or spacing. When *YES
is specified. the TXTMBR and TXTFILE parameters are
TRUNCATE Truncate the print line at a position. The default
is *NO meaning there is no truncation of the spooled
If you printed 132 bytes and are copying it into a
source member that is created for 80 bytes of data,
only 80 bytes will exist. If you want to truncate
more than the size of the SEU statement, enter the
position to start truncation.
Specify the first first position in the SEU
statement to be truncated (not the original print
The purpose of this parameter is to allow you to
print some information from the spooled file without
printing as much width as your SEU statement allows.
For example, if you are printing the SEU statements
in a format that allows 71 positions, you would want
to truncate the spooled file at position 71 at
least. See also the BORDER and RPLDOTS parameters.
If a value is entered, it must be between 30 and
The TRUNCATE and following parameters can best be
understood by using CPYSPLTXT with a 132 wide
spooled file to a normal source file (80 bytes of
data) and then altering the options.
BORDER Print asterisks as a border. The default is *NONE.
If *ROWS is specified, there will be a row of
asterisks before and after the spooled file data.
If *BOX is specified, the *ROWS functions is
performed as well as columns of asterisks. There
will be a column of asterisks in position 1 followed
by a column of blanks. The spooled file data begins
in position 3. Based on your truncation position, a
column of asterisks will appear at the position you
described. To the left of this position, there will
be a column of blanks. You must account for the 4
extra print positions when considering the *BOX
RPLDOTS Replace last 3 positions with dots if any data is
truncated. The default is *NO. If you are
truncating data, you can specify *YES to indicate in
the text member that data was truncated to assist
those that are looking at the information. The dots
will overlay the last 3 print positions on each line
where truncation occurred.
RULER Print a ruler at the top. *NO is the default. If
*YES is specified, the ruler will appear before the
spooled file data and before the border if one is
FROMSTRPOS From start position. The default is 1 to start
picking up the data at the leftmost position. If
you have data on the left of the spooled file lines
that you do not want to include in the output, you
can request to start at a 'from' position greater
than 1. If you specify position 10, the leftmost 9
characters of each input line will be ignored. The
remaining data is shifted to the left. After the
data is shifted, any truncation you have requested
TOSTRPOS To start position. The default is 1. If you want
to 'shift right' all of the output, specify a value
greater than 1. Just prior to the output of each
line, the data will be shifted right.
When copying to a text member there are certain considerations:
** If the width of the spooled print line is longer than the
source area in the file, automatic truncation will occur. You
can get more truncation using the TRUNCATE parameter.
** If you are copying in pictures of display files (using the
PRINT key), the output probably looks best if you specify
CHGJOB PRTKEYFMT(*NONE). This provides a spooled file of only
the screen image. You can use the TRUNCATE and BORDER options
on CPYSPLTXT to control how the data appears in the text
** The text member name SPL1 allows a work member for spooled
data. If the member does not exist, it is added. If it does
exist, the member is cleared first. If a different member
name is used, see the REPLACE parameter.
If you are adding records to a member created by EDTTXT, the
special source statements which exist for the use of EDTTXT
but are not normally shown to the user (e.g. .prt xxx) will
appear before the records you added. Consequently, it is
generally better to use an empty member (e.g. the default of
SPL1) and then copy the statements to the required member.
** When records are placed in a spooled file, only skip before
and space before entries exist (skip and space after are
converted as appropriate). When the records are copied to the
source member, the following rules apply to skipping and
spacing values in the spooled records:
-- Any skip entry (regardless of what line) is always
replaced by two blank source records. Thus if the
first spool record says skip to 06, you would see two
blank source records followed by a record containing
the spooled data.
-- Any space entry occurs as specified. Thus you will
always see blank records (up to 2) before the record is
-- You will never see more than two blank lines between
records regardless of what combinations of spacing and
skipping are in the record.
-- Overprinting will result in multiple records.
The following TAA Tools must be on your system:
ALCTMPMBR Allocate temporary member
RTVDAT Retrieve date
RTVSPLFOVR Retrieve spooled file override
SNDCOMPMSG Send completion message
SNDESCMSG Send escape message
SNDSTSMSG Send status message
None, the tool is ready to use.
Objects used by the tool
Object Type Attribute Src member Src file
------ ----- --------- ---------- -----------
CPYSPLTXT *CMD TAASPLB QATTCMD
TAASPLBC *PGM CLP TAASPLBC QATTCL
TAASPLBR *PGM RPG TAASPLBR QATTRPG
TAASPLBR2 *PGM RPG TAASPLBR2 QATTRPG