IBM 1130 User Manual page 642

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

Advertisement

Section
Subsections
Page
85
10
I
20
02
Building the index
Building your index of every 25th (or 90th, or
whatever) item in your file presents no difficulty.
Option 1: Build the index at the same time that
you load the data on the disk. All you need do is to
keep a sequential number for each item (NO) and
place its item number (or stock number, or em-
ployee number) in the INDEX array at position
NO /
(ISS + 1) + 1
where ISS is the index step size. In FORTRAN,
keeping an index of every four ITEMs (1SS=4) can be
done like this:
ISS
=
4
NO
=
1
55 READ (card) ITEM
K
=
(NO-I) /ISS+l
INDEX
(K)
=
ITEM
WRITE (file 'NO) ITEM, etc.
NO
=
NO + 1
GO TO 55
Tracing through this coding, you will see that in
addition to creating the data file on the disk:
The ITEM
will be placed
and at this
number from
on this disk
position in
this card
record
the INDEX table
first
1
1
second
2
1
third
3
1
fourth
4
1
fifth
5
2
sixth
6
2
seventh
7
2
eighth
8
2
ninth
9
3
etc.
When finished, the INDEX table will contain the
ITEM numbers of the 4th, 8th, 12th, 16th, etc.,
records on the disk, just as desired.
The INDEX
can now be written on the disk as a separate file,
for further use.
Option 2: Create an index file after the data
records have been placed on the disk. This is
even easier, since you need only read every 4th
(or 20th, etc.) record from the disk and place its
ITEM number in your INDEX table. Because this
would be relatively slow, you would want to do it
only once, with a separate program, storing the
INDEX as a separate data file.
Then, each program
using the file could read it from the disk.

Advertisement

Table of Contents
loading

Table of Contents