Spooler Plus Programmer's Guide

Using the Spooler Interface Procedures
Spooler Plus Programmers Guide522293-003
2-21
Spooling—Levels 1 and 2
Spooling With a Nonzero Sync Depth
To prevent a line from being duplicated, you can take advantage of the sync depth
feature of the file system.
To use this feature, you should open the collector with a nonzero sync depth. The
program should perform a checkpoint before every nth write to the collector, where n is
the sync depth. At that time, the following should be checkpointed:
The data stack
The data line about to be written to the collector
The synchronization block of the file to the collector, including the current sync ID
and the access control block
The collector will keep track of up to 15 sync IDs; therefore, an application program
can open the collector with any sync depth up to and including 15.
Example 2-6 is an example of level-2 spooling with a nonzero sync depth.
Example 2-6. Annotated Example of Level-2 Spooling From a NonStop Process
Pair With a Nonzero Sync Depth
(page 1 of 4)
! This program is an example of level-2 NonStop spooling with a
! sync depth of 5. It consists of 6 procedures: cherror,
! stbackup, error, sperror, getline, and root, and it calls the
! Guardian procedures OPEN, CLOSE, WRITE, STOP, CHECKOPEN, and
! CHECKPOINT. It also calls SPOOLSTART to specify the attributes
! of the job.
! cherror --this procedure handles checkpointing errors.
! It performs the necessary steps for recovery or it aborts the
! program. It has a single INT parameter that is the back error
! returned from CHECKOPEN or the status word returned from
! CHECKPOINT. If it is called with a 0 value, it will stop the
! backup process.
! stbackup --this procedure decides whether this program is the
! primary or backup procedure. If it is the primary, it starts a
! backup. Otherwise, it waits for checkpointing information from
! the primary. Opens $RECEIVE and reads the Startup message.
! 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.