Spooler Programmer's Guide

Sample Print Process
Spooler Programmer’s Guide522287-002
A-18
IF busy^flag THEN
CALL tell^super (invalid^operation, device, job^running)
ELSE
BEGIN
IF not dev^fnum THEN
CALL open^dev (device);
IF not dev^fnum THEN ! Open failed
RETURN;
data^line ':='
"....+....1....+....2....+....3....+....4....+....5....+....6"
&"....+....7....+....8....+....9....+....0....+....1....+....2";
error := writefile(dev^fnum, data^line, 120);
IF error THEN
BEGIN
msg^type := IF successful^op THEN
dev^error^1
ELSE
dev^error^5;
CALL tell^super (msg^type, device,
device^file^error + error);
successful^op := 0;
END;
successful^op := 1;
end^of^job^flag := 1;
END;
RETURN;
END;
! *===================================================================*
! CONTROL NUMBER = 7: SKIP TO PAGE
!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
! procedure name: SKIP^TO^PAGE
! parameters: SKIP^NUM - Specific page number where printing is to
! resume.
! DEVICE - name of device where job is printing.
! description: This procedure services the spooler supervisor command
! to skip to a specific page and resume printing. If the
! print process has not started a job (is not busy), the
! spooler supervisor is notified that the skip-to-page
! command is invalid.
!
! A call to CANCEL is issued to cancel any outstanding
! I/O request to prevent error 28 (too many outstanding
! no-wait requests) from occurring.
!
! The header flag is set to off so that the job page
! header will not be repeated. Control is then passed to
! the procedure READ^AND^PRINT, where the skip-to page
! number is passed in the PRINTREAD call. PRINTREAD will
! return the first record on the specified page, which is
! the skip-to page.
!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
PROC skip^to^page (skip^num, device);
INT skip^num,
.device;
BEGIN
INT error;
!---Beginning of code--------------------------------------------------
IF NOT busy^flag THEN
CALL tell^super (invalid^operation, device, no^job^printing)
ELSE