Spooler Programmer's Guide
Sample Print Process
Spooler Programmer’s Guide—522287-002
A-9
END;
IF header^index = 16 THEN
BEGIN
@ptr := @header[14].line '<<' 1;
ptr[20] := "*";
ptr[21] ':=' ptr[20] FOR 60;
error := writefile (dev^fnum,header[14].line,60);
IF error THEN
CALL ABEND;
header^index := 0;
RETURN;
END;
END;
! *===================================================================*
!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
! procedure name: READ^AND^PRINT
! parameters: PAGE^NUM - indicates page that will be printed
! DEVICE - name of the device where the job is printing
! description: This procedure gets and prints one line of the job. If
! the global flag HEADER^FLAG is true, then this
! procedure will print the job banner (header) by a
! succession of calls, one call for each line of the job
! banner, 15 lines in all.
!
! When HEADER^FLAG is false, the spooler procedure
! PRINTREAD is called to return a line of spooled data.
! The line of spooled data is written to the device when
! the error code returned from PRINTREAD is zero.
!
! There are six valid error codes that can be returned by
! PRINTREAD:
!
! 12000 = end of file found. The procedure STOP^JOB is
! called for job termination (normal is
! indicated).
! 12001 = end of copy found. The variable ERROR is
! reset to 0, HEADER^FLAG is set to its
! original start-of-job value, and control is
! passed back to the beginning of this
! procedure.
! 12002 = data file is bad. The procedure STOP^JOB is
! called for job termination (abnormal is
! indicated).
! 12003 = CONTROL found. CONTROL is issued to the IOP.
! If the CONTROL was successful, the next
! spooled data line is read. If unsuccessful,
! the spooler supervisor is notified of the
! error and the print job will be terminated.
! 12004 = SETMODE found. SETMODE is issued to the IOP.
! If the SETMODE was successful, the next
! spooled data line is read. If unsuccessful,
! the spooler supervisor is notified of the
! error and the print job will be terminated.
! 12005 = CONTROLBUF found. CONTROLBUF is issued to the
! IOP. If the CONTROLBUF was successful, the
! next spooled data line is read. If
! unsuccessful, the spooler supervisor is
! notified of the error and the print job will
! be terminated.
! > 12005 = invalid returned error code; the print
! process will abend.
!
! When the return code (variable ERROR) value from the
! procedure WRITE^DEV is 0 (positive return code),