Spooler Programmer's Guide

Sample Print Process
Spooler Programmer’s Guide522287-002
A-15
! procedure should move information contained in the
! calling parameters into a device table.
!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
PROC start^job (device, data^file^name, job^num, location, formname,
reportname, flags, params, dev^width, page^size);
INT .device,
.data^file^name,
job^num,
.location,
.formname,
.reportname,
flags,
params,
dev^width,
page^size;
BEGIN
LITERAL first^line = 0;
INT error,
read^only := 1 '<<' 10; ! used for opening data file
!---Beginning of code--------------------------------------------------
IF NOT dev^fnum THEN ! The spooler supervisor can ask us to
CALL open^dev (device); ! start a job without asking for the
! device to be opened.
IF NOT dev^fnum THEN
RETURN; ! The OPEN failed
error := openfile (data^file^name, data^file^fnum, read^only);
IF error THEN
BEGIN
CALL tell^super (end^job, device, data^file^error + error);
CALL STOP;
END
ELSE
IF PRINTSTART (job^buffer, p^buf, data^file^fnum) THEN
CALL ABEND;
!**** NOTE************************************************
! this would be a good location for the device table code
!*********************************************************
CALL SETMODE (dev^fnum, 28, 0);
busy^flag := 1;
dev.flags := flags;
dev.param := params;
dev.width := dev^width;
dev.job^num := job^num;
dev.page^size := page^size;
dev.locationname ':=' location for 8;
dev.formname ':=' formname for 8;
dev.reportname ':=' reportname for 8;
header^index := flags.<13>;
CALL read^and^print (first^line, device);
RETURN;
END;
! *===================================================================*
! CONTROL NUMBER = 3: STOP JOB
!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
! procedure name: REQ^STOP^JOB
! parameters: DEVICE - name of device where the job is to be printed
! description: This procedure services the spooler supervisor command
! to stop a job. If the print process is not busy