Spooler Programmer's Guide

Using the Spooler Print Procedures, Print
Processes, and Perusal Processes
Spooler Programmer’s Guide522287-002
3-5
Communicating With the Spooler Supervisor
3. Open the data file and the device, then call PRINTSTART. This places control
information for the job into a job-control-buffer. The control information in
the job-control-buffer consists of pointers to the current page and line
number, the file numbers of the supervisor and data file, and so on.
4. Call PRINTREAD to get one line of spooled data. PRINTREAD also updates the
control information in the print process buffer to point to the next line.
5. You can now access the job with a succession of calls to PRINTREAD.
In theory, the print process can take any action whatsoever with the data; the usual
action, though, is to write the data to the device specified by
PRINTREADCOMMAND.
Communicating With the Spooler Supervisor
Communication with the supervisor falls into two categories: responding to messages
and sending errors.
Responding to Spooler Supervisor Messages
The print process must periodically check for a completion on the file to the supervisor.
When a completion is detected, PRINTCOMPLETE is called to obtain the message,
which is then passed to PRINTREADCOMMAND for interpretation.
PRINTREADCOMMAND returns a control number to indicate the nature of the
message.
It is up to the programmer to decide how often to check for a supervisor message.
However, the more often you check for a message, the more responsive your print
process will be to Spoolcom commands. For example, a print process that checks for
completion after every write to the device can respond immediately to a message such
as “skip to page 3,” “send job status,” or “suspend job.”
The supervisor times out any print process that waits more than 10 minutes to respond
to a message. A print process that times out is put into the procerror state by the
supervisor, and any devices controlled by that print process are considered unusable.
Note. You can write a print process that handles as many concurrent jobs as you like, subject
to time and memory limitations. A separate job-control-buffer must be maintained for each job,
and there must be some way of keeping track of which job control buffers go with which
devices. The supervisor might attempt to start a job on each device that has been associated
with a print process (using Spoolcom). Therefore, if a print process is associated with devices
X, Y, and Z, it must be capable of handling three jobs concurrently.