Spooler Plus Programmer's Guide

Using the Spooler Interface Procedures
Spooler Plus Programmers Guide522293-003
2-27
Spooling—Level 3
Spooling With a Zero Sync Depth
After opening and initializing the level-3-buffer, you can begin spooling with the
interface procedures.
If SPOOLCONTROL, SPOOLSETMODE, SPOOLCONTROLBUF, or SPOOLWRITE
returns an error code of %11000, then the data given in the last call to that procedure
would cause the level-3-buffer to be written to the collector. The following
information should be checkpointed:
The data stack
The level-3-buffer (the number of bytes of level-3-buffer containing
valid data is returned in the bytes-written-to-buffer parameter of the
SPOOLWRITE, SPOOLSETMODE, SPOOLCONTROL, and
SPOOLCONTROLBUF procedures)
The data line that caused the %11000 return
After this information has been checkpointed, again call the procedure that returned
the %11000 as an error code, using the same data. It writes the level-3-buffer to
the collector on the second call and then begins refilling the buffer with the last line of
data that was resubmitted.
If the primary fails after the level-3-buffer has been written to the collector but
before the next checkpoint, it is possible that the entire level-3-buffer will be
written twice. To prevent this duplication, a nonzero sync depth is required.
Example 2-7 is an example of level-3 spooling with a zero sync depth.
Example 2-7. Annotated Example of Level-3 Spooling From a NonStop Process
Pair With a Zero Sync Depth
(page1of4)
! This program is an example of level-3 NonStop spooling with a
! zero sync depth. It consists of 6 procedures: cherror,
! stbackup, error, sperror, getline, and root, and it calls the
! Guardian procedures OPEN, CLOSE, STOP, CHECKOPEN, and
! CHECKPOINT. It uses the spooler interface procedures SPOOLSTART,
! SPOOLWRITE, and SPOOLEND to spool 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.