Spooler Programmer's Guide

Sample Print Process
Spooler Programmer’s Guide522287-002
A-12
wait^needed := 0; ! SETMODE is a waited
! operation
END;
END;
OTHERWISE
BEGIN
END;
! End of error case
END;
END
ELSE
! Successful PRINTREAD, write data to device
BEGIN
! If the DEV WIDTH is <0, allow any size of IO
! up to a limit set by the literal max^read^count.
! Otherwise truncate the IO so that we don't
! send more than WIDTH chars to the device
IF dev.width < 0 THEN
write^count := count^read
ELSE
write^count := $MIN ( dev.width , count^read );
out^buf ':=' data^line FOR write^count;
error := writefile (dev^fnum, out^buf, write^count);
IF error THEN
BEGIN
suspend := 1;
suspended := 1;
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;
END;
! End of DO loop
END
UNTIL wait^needed;
RETURN;
END;
! *===================================================================*
!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
! procedure name: STOP^JOB
! parameters: DEVICE - name of device job is printing on
! ERROR - error number
! description: Closes the collector data file if still open,
! initializes device and job variables/flags, and reports
! "end of job" status (thru TELL^SUPER) to the spooler
! supervisor
!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
PROC stop^job (device, error);
INT .device,
error;
BEGIN
!---Beginning of code--------------------------------------------------
IF data^file^fnum THEN
CALL CLOSE (data^file^fnum);
CALL init^job;
IF error AND error < 1000 THEN
CALL tell^super (invalid^operation, device, data^file^error +