Spooler Plus Programmer's Guide
Using the Spooler Interface Procedures
Spooler Plus Programmer’s Guide—522293-003
2-6
Summary of Spooling From an Application Program
Example 2-1. Annotated Example of Level-1 Spooling (page 1 of 2)
! This program is an example of level-1 spooling. It consists of 3
! procedures: error, getline, and root, and it calls the
! Guardian procedures OPEN, CLOSE, WRITE, and STOP.
! error --this procedure handles I/O errors. It performs the
! necessary steps for recovery or it aborts the program.
! sperror --this procedure handles Spooler errors. It performs the
! necessary steps for recovery or it aborts the program. It has
! a single INT parameter that is the error code returned from a
! Spooler Interface Procedure.
! getline --this procedure returns a line of data for spooling.
! It is an INT procedure that returns a zero (FALSE) value when
! it has no data to spool. It has two parameters: line and
! length. line is a reference to a 40-word (80-byte) array.
! The array is filled with the line of data to be spooled.
! length is a reference to an INT that is set to the number of
! bytes to be written from line.
! root --this is the main procedure. It performs all the file
! management to the collector and calls the other procedures in
! the program as needed.
?nolist
INT counter := 0;
?SOURCE $SYSTEM.SYSTEM.EXTDECS(OPEN, CLOSE, WRITE, STOP)
PROC error;
BEGIN
CALL STOP;
END;
INT PROC getline( line, length);
INT .line,
.length;