0% found this document useful (0 votes)
25 views

05 - Basic Seq File Upd

This document describes a process for sequentially updating records in a master file based on transaction records. It reads records from the transaction and master files, comparing their keys. If the keys match, it applies the transaction to update the master record. If the keys don't match, it either writes the master record to a new file or marks the transaction as invalid, then continues reading the next records. It also describes how to delete a master record when the transaction type is delete.

Uploaded by

VaidehiBaporikar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
25 views

05 - Basic Seq File Upd

This document describes a process for sequentially updating records in a master file based on transaction records. It reads records from the transaction and master files, comparing their keys. If the keys match, it applies the transaction to update the master record. If the keys don't match, it either writes the master record to a new file or marks the transaction as invalid, then continues reading the next records. It also describes how to delete a master record when the transaction type is delete.

Uploaded by

VaidehiBaporikar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 1

BASIC SEQUENTIAL FILE UPDATE

(NO ADDITIONS OR DELETIONS)

READ XACT; AT END XACT-KEY HIGH-KEY


READ MASTER; AT END MASTER-KEY HIGH-KEY
PERFORM-UNTIL XACT-KEY = HIGH-KEY AND MASTER-KEY = HIGH-KEY
IF MASTER-KEY = XACT-KEY THEN
APPLY XACT TO MASTER
READ XACT; AT END XACT-KEY HIGH-KEY
ELSE
IF MASTER-KEY < XACT-KEY THEN
WRITE MASTER TO NEW-MASTER-FILE
READ MASTER; AT END MASTER-KEY HIGH-KEY
ELSE /* MASTER-KEY > XACT-KEY */
INVALID XACT-KEY
READ XACT; AT END XACT-KEY HIGH-KEY
ENDIF
ENDIF
ENDPERFORM

(HIGH-KEY is a special key whose value is greater than that of


any actual key.)

DELETE A MASTER RECORD

APPLY-XACT:
.
.
.
IF XACT-TYPE = 'DELETE' THEN
REPORT MASTER RECORD DELETION
READ MASTER; AT END MASTER-KEY HIGH-KEY
ENDIF

353982849.doc Page 1 of 1
Donald Golden, 1996

You might also like