Spooler Plus Programmer's Guide
Using the Spooler Print Procedures, Print Processes, and
Perusal Processes
Spooler Plus Programmer’s Guide—522293-003
3-5
Retrieving and Printing Spooled Data
Retrieving and Printing Spooled Data
The sequence of events involved in retrieving and printing a job is as follows:
1. Open the spooler supervisor with nowait I/O, call PRINTINIT to format a print
control buffer, and call AWAITIO[X] to wait for a message from the supervisor. Call
PRINTCOMPLETE to get the print-control-buffer from the supervisor.
2. Call PRINTREADCOMMAND to interpret the information contained in the
supervisor print-control-buffer. PRINTREADCOMMAND returns the name
of the data file, the job route and attributes, and the name of the device on which
the job is to be printed.
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
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.