COBOL Manual for TNS and TNS/R Programs

Fault-Tolerant Processes
HP COBOL Manual for TNS and TNS/R Programs522555-006
32-12
Using the Fault-Tolerant Facility
The action your program should take in response to an exception status (a status other
than “0000”) depends upon your application and the location of the error in your
HP COBOL program. A takeover might need special processing. Most of the other
status values indicate a program coding problem or a system configuration problem.
Report the latter problem to the appropriate authority for your system.
How far and whether processing should continue following a nontakeover status is a
subject for careful analysis.
If a checkpoint failure occurs (that is, status “1000”, “2nnn ”, or “3nnn ”), the backup
process might remain in an invalid state; therefore, the HP COBOL fault-tolerant facility
stops the backup process if such a failure occurs. If the STARTBACKUP option 0, 1, or
2 was specified (signifying that the HP COBOL fault-tolerant facility is to monitor the
backup process), the facility tries to restart the backup process at the next execution of
the CHECKPOINT statement.
If the checkpoint failure persists for 10 restart cycles, the HP COBOL fault-tolerant
facility stops reestablishing a backup process and sets PROGRAM-STATUS to “5000.”
Example 32-1. Key Parts of Fault-Tolerant HP COBOL Program (page 1 of 2)
?NONSTOP
?SAVE PARAM
* Compiler directive specifies that the program is to be
* compiled for execution as a process pair.
FILE SECTION.
FD TEST-FILE
LABEL RECORD IS OMITTED
RECORD CONTAINS 100 CHARACTERS
DATA RECORD IS TEST-REC.
01 TEST-REC.
05 REC-NUM PIC 9(4).
05 ALTKEY-1 PIC X(5).
05 ALTKEY-2 PIC X(5).
...
WORKING-STORAGE SECTION.
01 CKPT-DATA.
* This defines pertinent control information that is
* checkpointed to the backup process
05 KEYNUM PIC 9 VALUE 0.
05 CURR-REC PIC 9(4).
05 CR REDEFINES CURR-REC.
10 FILLER PIC XX.
10 CR-1 PIC 9.
10 CR-2 PIC 9.
05 OLD-BASE PIC 9(4).
05 NEW-BASE PIC 9(4) VALUE 0.
77 BCPU PIC S9(4) COMP VALUE -1.