IBM 1130 User Manual page 644

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

Advertisement

Section
Subsections
Page
85
10
I
20
04
The subroutine returns:
NREC -- the record number where ITEM
may be found
IER -- an error code:
1 -- ITEM has been found on the disk.
2 -- ITEM is larger than any entry in
the index table.
3 -- ITEM is not on the disk where the
index table indicates that it
should be.
If IER is 2 or 3, the value of NREC returned is
meaningless.
For example, suppose you have an index of 150
entries, called ITABL, representing every 60th
item in an inventory file. After reading an inven-
tory detail card containing a field called ITEM,
you want to find the inventory record for that item.
By using subroutine FINDM
CALL FINDM (NR, ITEM, NFILE,
ITABL, 150,60, IER)
you obtain, perhaps, an NR of 731 and an IER of 1,
meaning that the desired ITEM has been found, at
record 731. You can now read the inventory record
for that item:
READ (NFILE'NR) data
Maintaining the Index
When using an indexed sequential disk data file, you
must make sure that the index agrees completely
with the file.
If you rearrange records in the file
without rebuilding the index, you may expect great
difficulty in locating items in the file.
Rebuilding
the index is a rather simple matter, and two
methods are given in a preceding section.
The file index is typically stored on the same
disk as the file itself, and is read into core once,
at the beginning of each program that uses the file
it
indexes.
Adding Items to the File
Adding items to an indexed sequential file can
be handled in much the same manner as for pure
sequential files. New records are placed in a
separate file, or at the "high" end of the main
file.
These new items will not be reflected in the
index, but this does not matter too much. The
index may be used to facilitate looking up records
in the main portion of the file, and,
if
an item is
not found there, it can be sought in the addition
area.

Advertisement

Table of Contents
loading

Table of Contents