COBOL Manual for TNS and TNS/R Programs

Fault-Tolerant Processes
HP COBOL Manual for TNS and TNS/R Programs522555-006
32-10
Using the Fault-Tolerant Facility
OPEN and CLOSE Statements
If a process is executing as a process pair (that is, the primary process has executed a
STARTBACKUP statement), checkpointing occurs automatically when any OPEN or
CLOSE statement executes and when the backup process is established. The
execution of STARTBACKUP and CHECKPOINT statements sets the PROGRAM-
STATUS variable to indicate the outcome of the checkpointing operation. The
execution of OPEN and CLOSE statements (because they establish takeover points)
also sets the PROGRAM-STATUS variable.
Following an OPEN or CLOSE of a file by the primary process, the sync blocks of all
other files in the backup process become invalid. If the SYNCDEPTH exceeds 1, you
must checkpoint both the record and the sync block of each file other than the one that
was opened or closed before executing the next WRITE statement.
PROGRAM-STATUS Data Item
Each HP COBOL run unit contains a four-digit data item called PROGRAM-STATUS,
shown in Figure 32-4. When a process is running as a process pair, this item is set by
the HP COBOL fault-tolerant facility to indicate the outcome of the execution of a
STARTBACKUP, OPEN, CLOSE, or CHECKPOINT statement.
If one of options 0 through 2 of the STARTBACKUP statement is used (that is, if the
HP COBOL fault-tolerant facility monitors the backup process), then the possible
values of PROGRAM-STATUS for any execution of a STARTBACKUP, CHECKPOINT,
OPEN, or CLOSE statement and their meanings are as shown in Table 32-1.
Figure 32-4. PROGRAM-STATUS Data Item
01 PROGRAM-STATUS.
05 PROGRAM-STATUS-1 PIC X.
05 PROGRAM-STATUS-2 PIC X(3).
Table 32-1. Values for PROGRAM-STATUS
When STARTBACKUP Has Option 0, 1, or 2 (page 1 of 2)
PROGRAM-STATUS
Value Meaning
0000 No error
0100 Takeover by backup, primary stopped
0101 Takeover by backup, primary aborted
0102 Takeover by backup, primary processor module failed
0103 Takeover by backup, primary called CHECKSWITCH
1000 Backup processor down
2nnn Communication error; nnn = file system error number
3nnn CHECKOPEN failure; nnn = file system error number