Saturday, March 16, 2013

Updating

Updating

to update a file means to alter it with new information. Updating can involve:

1 Adding new records.

2 Deleting existing records.

3 Changing the items within existing records.

Direct access files are sometimes updated one record at a time by a keyboard operator using a file updating program interactively on line. Otherwise files are usually updated by using a transaction file. The method for updating sequential files on magnetic tape is given here.

UPDATING A SEQUENTIAL TAPE FILE

1 A transaction file is prepared containing all the updating information. It contains details of all records which are to be added, deleted or changed.

Updating 

Fig 1 Updating a sequential file on magnetic tape

The records on this file are in the same order as the records on the master file (the one being updated). This is done by having both files arranged with their keys in ascending order.

Note: The files are arranged with their keys in the same order because otherwise the updating would take an impractically long time and involve much winding and rewinding of tapes.

2 An updating program is run which reads the master file and the transaction file one record at a time. At the same time a new, updated master file is written; the old master file is not changed. (See Fig 1)

Note: The old master file is not changed because:

(a) It is not practical to try to insert, change or delete records on an existing sequential file, particularly on tape.

(b) The old master file can still be useful for security purposes .