Spooler Programmer's Guide

Using the Spooler Print Procedures, Print
Processes, and Perusal Processes
Spooler Programmer’s Guide522287-002
3-10
Outline of the Basic Perusal Process
home terminal. Commands would allow you to display a specific page, skip ahead or
back pages, and so forth. You can implement the “display page” command with the
pagenum parameter of PRINTREAD; you can implement skipping relative to the
present page by calling PRINTINFO to determine the present page number and
computing the desired new page.
You could also use such a job scanner in conjunction with the SPOOLERCOMMAND
utility procedure, giving the job scanner the ability to delete a job (for example, if the
compilation contained too many errors) or to change the location of a job.
Outline of the Basic Perusal Process
The following steps summarize the perusal process:
1. Open a file to the spooler supervisor:
CALL OPEN( cntrlr^name, cntrlr^fnum ); ! must be waited
2. Pass to SPOOLEREQUEST the file number of the supervisor (obtained in Step 1)
and the job number of the job to be accessed. SPOOLEREQUEST returns a
message whose format is identical to the format of the message that the
supervisor sends to a print process to start a new job:
err := SPOOLEREQUEST( cntrlr^fnum, job^num, msg, );
IF err THEN ... ! error occurred
ELSE ... ! successful
3. Call PRINTREADCOMMAND to obtain the name of the data file in which the job is
located. If desired, you can also obtain job attributes. Open the data file:
CALL PRINTREADCOMMAND( msg,,,,,,, data^file,, location );
CALL OPEN( data^file, data^file^fnum );
4. Call PRINTSTART, passing a 560-word job-buffer:
err := PRINTSTART( job^buf, msg, data^filenum );
IF err THEN ... ! PRINTSTART error
ELSE ... ! OK to begin reading the job
5. The job can now be accessed with a succession of calls to PRINTREAD:
err := PRINTREAD( job^buf, data^line, read^count );
IF err THEN ... ! PRINTREAD error
ELSE ... ! data^line contains the
! next line of spooled data
At this point, the perusal process performs an operation with data^line, such as writing
it to a terminal. The next call to PRINTREAD returns the next line of the job, and so
on, until end of file.
Note. Some PRINTREAD messages occur normally, such as end of file, end of copy,
CONTROL, and SETMODE.