The Print Page Range command offers a convenient method of printing a
subset of a spooled file. PRTPAGRNG does a CPYSPLF and then
re-prints a spooled file that will contain only the requested pages.
Only normal DP output is supported (no special graphics). PRTPAGRNG
may be used in some cases when the system spool support cannot be
used or has restrictions when using a page range on a spooled file.
A typical command would be:
PRTPAGRNG FILE(xxx) FROMPAGE(15) TOPAGE(21)
The spooled file would be re-printed to the specified output queue.
By default, the new spooled file name would be the old name with a 2
on the end such as PAYROLL becomes PAYROLL2.
Only pages 15 thru 21 would be included. The 15th page of the
spooled file may or may not be the 15th page number as written by the
application that originally created the spooled file. If the 15th
page has a heading that says 'Page 15', it appears as 'Page 15' in
the new spooled file.
You may print the last page with the command:
PRTPAGRNG FILE(xxx) FROMPAGE(*LAST)
You may print from a page to the end of the spooled file with the
PRTPAGRNG FILE(xxx) FROMPAGE(15) TOPAGE(*LAST)
The system supported method of printing a range of pages by use of
the PAGERANGE parameter on CHGSPLFA is more efficient. However, it
may be more convenient to use PRTPAGRNG which also has the advantage
that the original spooled file is still ready to be printed in its
entirety (you do not need to reset the PAGERANGE parameter).
The user of the command becomes the owner of the new spooled file.
The default output queue of the user of the command will contain the
new spooled file.
Page N of N indication
You may optionally request a string of text that includes the current
page number and total pages to print on a specific line on each page.
The intent is to be able to print a line such as:
2 of 27
See the parameters for Page Indication. The parameters will only
appear if you use F9 on the command prompt.
The PRTPAGRNG command does CPYSPLF to a data base member in QTEMP and
then rewrites a subset of the file to a new member. CPYF is then
used to re-print the data with *FCFC (first character forms control).
PRTPAGRNG command parameters *CMD
FILE The spooled file name to be re-printed.
TOOUTQ The qualified name of the output queue where the
subset spooled file will be written. The default is
*PRTF meaning to use the output queue defined for
the printer file as specified on the TOPRTF
If an output queue is specified, a blank output
queue library name defaults to *LIBL. *CURLIB may
be specified. Using other than the default
overrides the value specified in the printer file.
If you take the default for both TOOUTQ and TOPRTF,
the spooled file is written to the QSYSPRT printer
file. The QSYSPRT file is shipped with a default of
*JOB for the OUTQ parameter meaning the output queue
associated with your job would be used.
FROMPAGE The 'from page number' to begin the re-print from.
The default is 1. The special value *LAST may be
used for the last page in the file. The value must
be equal or less than the TOPAGE value.
TOPAGE The 'to page number' to end the re-print at. The
default is *LAST meaning the last page in the file.
JOB The qualified name of the job containing the spooled
file. * is the default meaning the current job.
SPLNBR The spooled file number. The default is *ONLY.
*LAST may be specified or a specific 4 digit number.
TOPRTF The qualified name of the printer file to be used to
reprint the data. The default is QSYSPRT. The
library defaults to *LIBL. *CURLIB may be
Most of the attributes from the printer file will be
used except for OUTQ (may be overridden by the
TOOUTQ parameter), SPLFNAME (from the NEWSPLF
parameter), and USRDTA (PRTPAGRNG is used). Page
size, overflow line, page width, LPI, CPI, etc come
from the spooled file being copied.
You may use an OVRPRTF command in your job prior to
using PRTPAGRNG to specify individual printer file
attributes. The attributes will be merged according
to the rules of override processing.
For example, you could use an OVRPRTF command to
file QSYSPRT and specify the value for the COPIES
NEWSPLF The new spooled file name to be used. The default
is *DFT which means the same name as the FILE
parameter will be used with a 2 added to the name.
For example, if the original spooled file is
PAYROLL, the new spooled file would be PAYROLL2.
The value of this parameter overrides the value of
the SPLFNAME parameter specified in the TOPRTF
DBCSDATA A *YES/*NO option for whether the file contains DBCS
*NO is the default.
If *YES is specified, the internal file is created
to allow DBCS data and the print line is shifted to
the left one position.
PAGIND Whether to print a page indication such as 'Page N
of N'. The default is *NO.
*YES may be specified to print a page indication.
18 positions must be reserved on a specific line of
PAGINDLIN The line to print the page indication on. The
default is 1. This means the first print line on
each page (it may not be line 1 of the page).
PAGINDPOS The position on the print line for the page
indication. 18 bytes will be printed. The default
You may precede the position with a word like
'Page'. For example, if you wanted a string of
'Page N of N' and you use PAGINDPOS(45), you would
output the word 'Page' from your program ending in
PAGINDWRD The word to use instead of 'of' for the string of
text 'N of N'. This allows a text string of 'N - N'
or a language translation. Up to 6 bytes may be
Only DP output (no special printer graphics) may be used.
The following TAA Tools must be on your system:
RTVSPLFA Retrieve spooled file attributes
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
------ ---- --------- ---------- ----------
PRTPAGRNG *CMD TAASPLY QATTCMD
TAASPLYC *PGM CLP TAASPLYC QATTCL
TAASPLYR *PGM RPG TAASPLYR QATTRPG