Spooler Programmer's Guide

Sample Print Process
Spooler Programmer’s Guide522287-002
A-20
! is notified that the status command is invalid.
!
! The spooler procedure PRINTINFO is called to fetch
! information about the current print job.
!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
PROC send^status (device);
INT .device;
BEGIN
INT error,
page,
line,
total^lines,
num^copies;
!---Beginning of code--------------------------------------------------
IF NOT busy^flag THEN
CALL tell^super (invalid^operation, device, no^job^printing)
ELSE
BEGIN
error := PRINTINFO (job^buffer, num^copies, page, line,
total^lines);
IF error THEN
CALL ABEND;
CALL tell^super (sending^status, device, page, line,
total^lines, num^copies);
END;
RETURN;
END;
! *===================================================================*
! outer program loop
!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
! procedure name: MAIN^LOOP
! parameters: none
! description: This procedure is the nucleus of the print process. It
! issues the call to AWAITIO and services its
! completion. The AWAITIO completion is divided into two
! sections, completion of spooler supervisor requests
! and completion of writes to the device. The writes to
! the device are further divided into two areas,
! successful writes and unsuccessful writes.
!
! SUPERVISOR REQUEST COMPLETIONS: The spooler procedure
! PRINTCOMPLETE is called to obtain a message (command)
! from the spooler supervisor. The message is contained
! in the buffer P^BUF. If an error is returned by
! PRINTCOMPLETE, the print process will terminate
! abnormally and no error message is issued. NOTE: there
! are other options than abending the print process (for
! example, retry the PRINTCOMPLETE call). Also, issuing
! an error message should be considered.
!
! Upon successful completion of PRINTCOMPLETE, the
! spooler procedure PRINTREADCOMMAND is called to
! interpret the message returned by PRINTCOMPLETE. Here
! again, if PRINTREADCOMMAND returns an error, the print
! process will terminate abnormally and no error message
! is issued.
!
! Upon successful completion of PRINTREADCOMMAND, the
! command value stored in "control" is used to select the