Spooler Plus Programmer's Guide

Spooler Plus Programmers Guide522293-003
A-1
A Sample Print Process
This appendix shows an example of a print process. It includes a description of the
program and the code.
The example has been kept as simple as possible in the interest of clarity.
Simplifications include the following:
Only one job at a time can be printed.
No form alignment is performed.
The record size of all devices is assumed to be 132.
The truncation flag is ignored.
The print process parameter and device parameter are not used.
The structure of the sample print process is such that these features can easily be
implemented.
INT .p^buf[0:63], ! print control buffer
.job^buffer[0:559], ! job buffer
.data^line[0:65], ! next line of data
count^read, ! number of bytes in "data^line"
.out^buf[0:65], ! buffer written to device
.time^array [0:6], ! date & time for header pages
recv^fnum, ! $RECEIVE file number
supv^fnum, ! supervisor file number
dev^fnum, ! device file number
data^file^fnum, ! collector data file number
busy^flag := 0, ! true when a job is printing
suspend := 0, ! true when a job is suspended
suspended := 0, ! true when a job is suspended due
! to a write error
end^of^job^flag := 0, ! true = indicates end of job,
! start job clean-up tasks
header^index :=0, ! true = print job banner page
msg^type, ! used to send error to supervisor
successful^op := 1; ! used to determine which message
! type is sent on device error
! information returned by
! PRINTREADCOMMAND
STRUCT DEV;
BEGIN
INT flags; ! indicates the state of the
! device's header and
! truncation flags
INT param; ! parameter specified in the
! "DEV, PARAM" SPOOLCOM
! command
INT width; ! value specified in the "DEV,
! WIDTH" SPOOLCOM command
INT job^num; ! spooler-assigned job number
INT locationname[0:7]; ! location name
INT formname[0:7]; ! form name
INT reportname[0:7]; ! report name
INT page^size; ! number of lines per page
END;
STRING
Note. The program presented in this appendix can be compiled and run exactly as presented. However,
it is not a supported software product of HP and has not undergone the rigorous testing given to an
officially released product. Please keep this in mind when adapting the code for your needs.