Adding Items To The File - IBM 1130 User Manual

Computing system
Hide thumbs Also See for 1130:
Table of Contents

Advertisement

Section
Subsections
Page
85
10
I
10
02
Programming such a search is easy:
3
8
10
9
NREC
=
0
INC
=
500
INC
=
(INC+ 1)/2
READ (NFILE'NREC) KEY
IF (KEY-KEYXX) 8,9,10
NREC
=
NREC + INC
GO TO 3
NREC
=
NREC-INC
GO TO 3
KEYXX has been found at record NREC.
Adding Items to the File
Adding new records to a sequential file involves
some advance planning.
If
your employee file now
consists of 188 employee records in man number
sequence
018, 023, 067, 107, 109, ....... 667, 691, 806, 902
where should you put the newest employee, who has
just been assigned man number 098? You could
rebuild the entire file, but that might prove time-
consuming in the case of large files.
One way to handle file additions is to set up a
separate "addition area" on the disk, either as a
separate file or as a special area in the main file.
With the latter option, new employees would be
placed at the end of the file, starting with the last
record and working backward.
For example, suppose the 188 employee records
have been placed in a 200-record file. When man
number 098 is added, it is placed in record number
200; the next new man number goes in 199; and so
on.
The search programming becomes somewhat
more involved: if a man number is not found in the
main (sequential) portion of the file, the "addition
area" is searched. If it is not found in either place,
an error message is printed.
Since this added work will slow the running of the
program, the file should be reorganized periodically,
and new man numbers put in their proper places in
the sequential file.

Advertisement

Table of Contents
loading

Table of Contents