FORTRAN Reference Manual

Fault-Tolerant Programming
FORTRAN Reference Manual528615-001
16-8
Checkpointing File Status Information
COMMON request_msg, db_record
CHARACTER*132 reply_msg
OPEN (UNIT=1,FILE='$RECEIVE')
OPEN (UNIT=2,FILE='employee',SYNCDEPTH=5)
START BACKUP (BACKUPSTATUS=ierr)
...
10 READ (UNIT=1) request_msg
CHECKPOINT(UNIT=1, UNIT=2,STACK='YES') request_msg,
process request, generate a DB record and a reply
CHECKPOINT(UNIT=1, UNIT=2,STACK='YES') db_record
WRITE (UNIT=2) db_record
WRITE (UNIT=1) reply_msg
GO TO 10
Requesters and Servers
In the preceding code, there are two separate files to consider: $RECEIVE and the
disk file EMPLOYEE. The server opens both $RECEIVE and the EMPLOYEE file.
Because unit 2, the disk file, specifies SYNCDEPTH = 5, the system must remember
the completion status of up to five nonretryable requests for EMPLOYEE—for
example, any WRITE requests.
After opening units 1 and 2, the server reads $RECEIVE to obtain REQUEST_MSG,
which contains a request and any data needed by the server. Next, the server
checkpoints the file status information for the files associated with units 1 and 2, the
data stack from the initial stack marker to the top of the stack (STACK='YES'), and
REQUEST_MSG. The server must specifically name REQUEST_MSG in the
CHECKPOINT statement because REQUEST_MSG is in a common block and,
therefore, is not checkpointed as part of the stack. The server then processes the
request and executes a stack checkpoint that includes a disk record (DB_RECORD).
The reply to the requester (REPLY_MSG) is also checkpointed because it is in the
stack. Finally, the server writes the database record (DB_RECORD), writes the reply
(REPLY_MSG) to $RECEIVE, and branches to the top of its read loop to read the next
request.