Spooler Programmer's Guide

Using the Spooler Interface Procedures
Spooler Programmer’s Guide522287-002
2-8
Summary of Spooling From an Application Program
4. The job leaves the open state when you close the file to the collector with the file-
system CLOSE procedure. Depending on the hold option specified in the call to
SPOOLSTART, the job will go to the READY state or the HOLD state at the
location specified.
Example 2-2 is an example of level-2 spooling.
Example 2-2. Annotated Example of Level-2 Spooling (page 1 of 3)
! This program is an example of level-2 spooling. It consists of 4
! procedures: error, sperror, getline, and root, and it calls the
! Guardian procedures OPEN, CLOSE, WRITE, and STOP. It also
! calls SPOOLSTART to specify the attributes of the job.
! 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 the 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.