Spooler Programmer's Guide

Sample Print Process
Spooler Programmer’s Guide522287-002
A-14
PROC close^dev (device);
INT .device;
BEGIN
!---Beginning of code--------------------------------------------------
IF busy^flag THEN
! Cannot close device; currently printing a job
CALL tell^super (invalid^operation, device, job^running)
ELSE
BEGIN
IF NOT dev^fnum THEN
! Device is already closed
ELSE
BEGIN
CALL CLOSE (dev^fnum);
IF < THEN
CALL ABEND;
dev^fnum := 0;
END;
END;
RETURN;
END;
! *===================================================================*
! CONTROL NUMBER = 2: START JOB
!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
! procedure name: START^JOB
! parameters: DEVICE - name of device where the job is to be printed
! DATA^FILE^NAME - name of the collector data file
! JOB^NUM - job number of the current job
! LOCATION - location name
! FORMNAME - name of form
! REPORTNAME - name of report
! FLAGS - flags that indicate items such as header on
! PARAMS - user parameter word defined through SPOOLCOM
! DEV^WIDTH - device width in bytes, defined through
! SPOOLCOM
! PAGE^SIZE - number of lines in a page
! description: This procedure services the spooler supervisor command
! to start a job. The collector data file is opened (read
! only). If the open is unsuccessful, the spooler
! supervisor is notified that the job has ended, and the
! file-system error (plus spooler print process error
! base number) that caused the job to end (in this case
! terminated) is returned.
!
! The spooler procedure PRINTSTART is called to format
! the job buffer for the job being started. The job
! buffer will be used in subsequent calls to the spooler
! procedure PRINTREAD when reading data from the
! collector file.
!
! SETMODE 28 is issued to the IOP to reset the line
! parameters back to the SYSGEN/OSBUILDER or default values.
!
! Control is then passed to the procedure READ^AND^PRINT
! to fetch data from the collector data file and write it
! to the device.
!
! ***NOTE*** As stated in the beginning of this print
! process, it is designed to support only one device. If
! it is desired to support more than one device, this