Spooler Programmer's Guide

Using the Spooler Interface Procedures
Spooler Programmer’s Guide522287-002
2-18
Spooling—Levels 1 and 2
synchronization block for the file to the collector immediately before every write of a
line of data to the collector.
In the event of a failure after the checkpoint, the backup process will execute the write
with the correct line.
If the failure occurs following the write but before the next checkpoint, the backup will
re-execute the write of the last line sent. When you print this job, the listing will contain
two copies of the line.
Example 2-5 illustrates this checkpointing strategy in level-1 spooling.
Note. When you open a job with a sync depth of 0, the collector does not checkpoint as often
for level-1 jobs as it does for jobs with a higher sync depth. Level-1 jobs opened with a sync
depth of 0 could lose lines of data when a collector takeover occurs.
Example 2-5. Annotated Example of Level-1 Spooling From a NonStop Process
Pair With a Zero Sync Depth
(page1of3)
! This program is an example of level-1 NonStop spooling with a
! zero sync depth. It consists of 5 procedures: error, cherror,
! stbackup, getline, and root, and it calls the Guardian
! procedures OPEN, CLOSE, WRITE, STOP, CHECKOPEN, and CHECKPOINT.
! error --this procedure handles I/O errors. It performs the
! necessary steps for recovery or it aborts the program.
! 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 opens $RECEIVE, checks the Startup
! message, and 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.
! 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.
! 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;