Spooler Programmer's Guide

Using the Spooler Print Procedures, Print
Processes, and Perusal Processes
Spooler Programmer’s Guide522287-002
3-9
Writing a Perusal Process
2. Declare a print device, specify its print process to be the one you are debugging,
and connect the device to a location.
3. Run a simple job to your debugging spooler—for example, try a TACL FILES or
STATUS command, specifying your collector as the OUT file.
4. When the command interpreter prompt (for example, TACL 17>) comes back,
indicating that the spooler has accepted your job, enter PAUSE.
The Debug prompt should appear at your terminal, and you can now debug your print
process.
To see how to debug spooler with another debugging program such as Garth or a
similar HP product, see the appropriate documentation.
Writing a Perusal Process
The preceding subsection explains how a print process communicates with the spooler
supervisor to access spooled data. This subsection describes how a process can
access spooled data without communicating with the supervisor. This kind of process
is called a perusal process, an example of which appears in Appendix 3, Using the
Spooler Print Procedures, Print Processes, and Perusal Processes. Peruse is the
perusal process supported by HP.
For a perusal process to get the necessary control information that a print process
obtains from a spooler job-start message, it calls the spooler utility procedure
SPOOLEREQUEST, which provides it with a message identical to the message that
the supervisor sends when starting a job. This message allows a perusal process to
use the PRINTREADCOMMAND, PRINTSTART, PRINTSTART2, PRINTREAD, and
PRINTINFO procedures as if it were a print process. However, a perusal process
cannot use the PRINTCOMPLETE, PRINTCOMPLETE2, PRINTINFO, PRINTINIT,
PRINTINIT2, PRINTSTATUS, and PRINTSTATUS2 procedures.
The key difference between a print process and a perusal process is that the print
process operates in conjunction with and under the control of the supervisor, while a
perusal process operates on its own. This independence of a perusal process from the
supervisor makes perusal programs easy to code, because the perusal process need
not monitor and respond to the supervisor.
Nevertheless, a perusal process should monitor its own messages to the supervisor in
case the supervisor goes down (resulting in an error message in response to a
message to it) and prevents the perusal process from running successfully.
A perusal program has no way of preventing a job from being deleted from it. If this
should happen, PRINTREAD returns %12002, invalid data file. When a perusal
process encounters this condition, it can no longer read data from the job.
You can use a perusal process for such things as scanning a job (such as a compiler
listing) in order to decide whether the job should be printed. You can also display data
on a special terminal in a customized way. You can write an interactive job scanner
that allows a user to select a job for scanning and displays pages of the job on the