The Copy Spooled File 2 command is like the system CPYSPLF command
except that it adds blank lines and a new page indication to the data
base file. If you are going to transfer print lines to some other
medium, CPYSPLF2 may be helpful.
A typical command would be:
CPYSPLF2 FILE(xxx) TOFILE(yyy)
The TOFILE must exist. It must be a physical file TYPE(*DATA) and
must have sufficient record length to hold the print lines.
A blank data base record would exist for each blank line that would
appear in the printed output.
On the first page and for every new page, a special record is written
to the data base file. The default is **NEWPAGE** which appears in
positions 1-15 of the data base record.
You may enter your own NEWPAGE indication by using the NEWPAGE
parameter. For example, if the medium you will eventually write to
requires a special value to cause a skip to a new page, you could
insert that value for the NEWPAGE parameter.
You may specify either a 'shift left' or 'shift right' value to shift
the print lines in the TOFILE.
PRTCPYSPL2 Tool
---------------
Some applications may want to store the spooled information in a data
base file to allow a display using a program rather than using
DSPSPLF. When the display appears, it may be desirable to offer a
print option. The PRTCPYSPL2 command will allow you to generate a
spooled file from the data base file that was output by CPYSPLF2.
Command parameters *CMD
------------------
FILE The spooled file to be copied.
TOFILE The data base file to contain the copied spooled
file.
The file must exist. It must be a physical file
TYPE(*DATA) and must have sufficient record length
to hold the print lines.
JOB The qualified job name of the job with the spooled
file. The default is * meaning the current job.
SPLNBR The file number of the spooled file. This defaults
to *ONLY. *LAST or a specific number may be
specified.
TOMBR The member of the data base file that will contain
the copied spooled file. The default is *FIRST.
If the member does not exist, it will be added.
MBROPT Whether to clear the member before writing data.
*REPLACE causes the member to be cleared.
*ADD causes data to be added to the member. If you
are going to combine multiple spooled files into the
same member, use *ADD.
RMVOVRPRT Whether to attempt to remove overprint records. The
default is *NO meaning that every spooled file
record that is read is output assuming that
MRGOVRPRT(*NO) is also specified. If a line is
overprinted, multiple spooled records may exist.
*YES may be specified to bypass duplicate overprint
records in some cases. CPYSPLF2 uses CPYSPLF
internally with CTLCHAR(*PRTCTL). This outputs 4
characters at the beginning of the record (3 for
skip before and 1 for space before). If *YES is
specified, any lines with a 0 space before value and
identical print line data are bypassed.
MRGOVRPRT Whether to merge overprint records. The default is
*NO meaning that every spooled file record that is
read is output assuming RMVOVRPRT(*NO) is also
specified. If a line is overprinted, multiple
spooled records may exist.
*YES may be specified to merge the output to a
single output record. CPYSPLF2 uses CPYSPLF
internally with CTLCHAR(*PRTCTL). This outputs 4
characters at the beginning of the record (3 for
skip before and 1 for space before). Note that no
skip or space after information is available. All
space/skip controls from the high level language are
turned into space/skip before.
If MRGOVRPRT(*YES) is specified, a print record is
stored internally and not output immediately. If
the next record has 0 space before and 0 skip before
values, the data from this record is merged with the
previous record. This means if the 2nd record has a
non-blank value in one of the print positions, it
overlays the data from the previous record in the
same position.
More than 2 records can contribute to the same
merged line. As long as the current record has 0
space and 0 skip before values, the data is merged.
When a new record has a plus value for either space
or skip before, the stored internal record is
output.
SHIFTLEFT Whether to shift the print lines to the left. The
default is 0, so no shifting occurs.
If a value is entered between 1 and 100, the print
lines will be shifted to the left. For example, if
your first printing position in the spooled file is
position 5, you can shift to position 1 by
specifying SHIFTLEFT(4).
SHIFTRIGHT Whether to shift the print lines to the right. The
default is 0, so no shifting occurs.
If a value is entered between 1 and 100, the print
lines will be shifted to the right. For example, if
your first printing position in the spooled file is
position 5, you can shift to position 15 by
specifying SHIFTRIGHT(10).
CTLCHAR Whether to include the print control characters in
the output. The default is *NONE meaning only data
(no control characters) will be in the output.
*PRTCTL may be specified to include the print
control characters in the first 4 positions of the
output. The value generated from the same parameter
on CPYSPLF is passed thru to the output. The
NEWPAGE value continues to begin in position 1.
NEWPAGE The 'new page' indication that will appear at the
beginning of each new page including the first.
The default is **NEWPAGE** which will appear in
positions 1-11 of the data base record.
A specific value (up to 15 characters) may be
entered. For example, if the medium you will
eventually write to requires a special value to
cause a skip to a new page, you could insert that
value for the NEWPAGE parameter.
A single blank (' ') may be entered for a blank
separator.
Restrictions
------------
** Only DP output is supported (no special graphics).
** Overprinting (printing multiple print lines on top of each
other) is not supported in all cases. An option exists to
attempt to bypass records caused by overprinting (see
RMVOVRPRT).
Since a spooled file is read, any overprinting may have been
handled by the program that creates the spooled record.
Consequently, the data base record may contain the merged data
from any overprinting and therefore the data base record would
contain the same information. An exception to this is the use
of underlines. Any use of underlines will cause a separate
data base record.
Prerequisites
-------------
The following TAA Tools must be on your system:
HLRMVMSG HLL Remove message
SNDCOMPMSG Send completion message
SNDESCMSG Send escape message
SNDSTSMSG Send status message
Implementation
--------------
None, the tool is ready to use.
The TOFILE must exist.
Objects used by the tool
------------------------
Object Type Attribute Src member Src file
------ ---- --------- ---------- ----------
CPYSPLF2 *CMD TAASPLZ QATTCMD
TAASPLZC *PGM CLP TAASPLZC QATTCL
TAASPLZR *PGM RPG TAASPLZR QATTRPG
TAASPLZR2 *PGM RPG TAASPLZR2 QATTRPG
Structure
---------
CPYSPLF2 Cmd
TAASPLZC CL pgm
TAASPLZR RPG program - normal use
TAASPLZR2 RPG program - MRGOVRPRT(*YES)
|