Spooler Programmer's Guide
Sample Print Process
Spooler Programmer’s Guide—522287-002
A-10
! control is passed back to MAIN^LOOP. When the return
! code value is <> 0 (negative return code), the spooler
! supervisor is notified of the error and the job will be
! terminated.
!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
PROC read^and^print (page^num, device);
 INT page^num,
 .device;
 BEGIN
 LITERAL end^of^file = %12000,
 end^of^copy = %12001,
 control^found = %12003,
 setmode^found = %12004,
 next^line = 0;
 INT write^count, ! number of bytes to be written
 error,
 wait^needed; ! Set true when we need to return.
!---Beginning of code--------------------------------------------------
next^copy:
 IF header^index THEN
 BEGIN
 IF header^index = 1 THEN
 BEGIN
 ! Issue CONTROL to IOP print process
 CALL CONTROL (dev^fnum, 1, 0);
 IF <> THEN ! check CONTROL condition code
 BEGIN
 ! CONTROL was unsuccessful
 suspend := 1;
 suspended := 1;
 CALL FILEINFO (dev^fnum, error);
 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
 ELSE
 ! CONTROL was successful
 successful^op := 1;
 header^index := header^index + 1;
 END
 ELSE
 CALL build^header;
 END
 ELSE
! Get either first or next line of spooled data
 DO
 BEGIN
 wait^needed := 1;
 error := PRINTREAD (job^buffer, data^line, max^read^count,
 count^read, page^num);
 IF error THEN
 BEGIN
 CASE error - end^of^file OF
 BEGIN
!-12000- end of file found










