71
338
iSeries Printing VI: Delivering the Output of e-business
using QRCVDTAQ, refer to the iSeries Information Center at:
http://publib.boulder.ibm.com/pubs/html/as400/infocenter.html
To learn more about using the data queue reference in an output queue, and
the layout of the information within it, see
iSeries Printer Device Programming
,
SC41-5713.
2. Perform a table or file lookup to find out how that file should be handled. For
example, what is the destination output queue and the name of the form
definition and page definition objects that you created using Infoprint Designer
that are to be used?
In some cases, enough information is provided from the data queue entry,
such as the spooled file name, job or user name, or output queue, to uniquely
determine the resulting action. In other cases, you must call system API
QUSRSPLA to Retrieve Spooled File Attributes to obtain more information on
which to make the decision. The information retrieved about the spooled file
includes data stream type, page size, overlay name, user data, and form type,
among other things. For more information about QUSRSPLA, see
AS/400
System API Reference
, SC41-5801,
or the iSeries Information Center on the
Web.
3. Use the Copy Spooled File (CPYSPLF) command to copy the spooled file to a
physical file. To preserve the page and line spacing of the original spooled file,
you must capture the carriage control information in the first byte of the file. To
do this, make sure you specify
CTLCHAR(*FCFC)
in your CPYSPLF command,
and make sure the target physical file record length is one more than the
longest record in the spooled file.
4. Create or modify a printer file based on the requirements of the application. In
the case of Infoprint Designer applications, you must specify
DEVTYPE(*LINE)
,
the form definition name
(
FORMDF
), the page definition name
(
PAGDFN
), and the
target output queue
(
OUTQ
). You must also specify
CTLCHAR(*FCFC)
so it knows
to use the first byte as the carriage control information rather than as data.
If the form definition you use specifies duplex or different paper sources, you
also must specify
DUPLEX(*FORMDF)
or
DRAWER(*FORMDF)
.
5. Copy the data from the physical file to this new printer file using CPYF. This
automatically creates a new spooled file.
6. Delete the original spooled file or move it to a hold or done queue.
Along with the monitor program, a robust system must also include housekeeping
functions, such as error checking and table maintenance. If there is a problem,
and the monitor ends abnormally, spooled files may have to be held and released
to put a record back in the data queue.
The newly generated spooled file ends up being “owned” by the user who
started the monitor program rather than the original owner. Therefore, the
original owner is not able to perform a WRKSPLF command with the default
parameters to see their new files. One suggestion is to pick up the original
user’s name from the job information that is picked up from the data queue
and place it in the USRDTA field of the printer file.
Note