Spooler Programmer's Guide

Spooler Programmer’s Guide522287-002
B-1
B Sample Perusal Process
This appendix shows a sample perusal process. This sample process functions in
much the same way as the listing section of the PERUSE program. The sections of
code concerned with taking commands from the terminal and listing errors are not
included because they are not actually related to the perusal process operation.
! This program performs some of the operations executed by PERUSE.
! The purpose of this program is to illustrate the use of the
! spooler utility procedures and print procedures in a perusal
! process. The commands recognized have been reduced to a subset
! of the PERUSE commands. They include LOC, HOLD, JOB, DEV, LIST,
! and EXIT. The DEV command has been enhanced to return the status
! of all devices when an argument is not supplied.
! All input is taken from the home terminal, and all output is returned
! to the home terminal (IN and OUT files are not used).
! This program can be copied from this guide and compiled.
?page
STRING command [8:104] = 'P' := ["LOC ",
"HOLD ",
"JOB ",
"DEV ",
"LIST ",
"EXIT ",
"LO ",
"H ",
"J ",
"D ",
"L ",
"E "];
! This structure is used to get the status of devices
STRUCT .dev^stat;
BEGIN
INT name[0:15],
state,
last^error,
flags;
STRING form^name [0:15];
INT retry^interval,
time^out,
speed;
STRING print^process [0:5];
INT job^number,
parameter,
width,
retries,
busy^time[0:1];
END;
Note. The program presented in this appendix can be compiled and run 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.