Direct, Or Random Organizations; Direct; Computed Direct - IBM 1130 User Manual

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

Advertisement

Direct, or Random, Organizations
Direct
The simplest of all organizations exists when the
record number is the same as the control key. For
example, in a payroll application requiring one
record per employee, the record number would be
the same as the employee number.
If
you had a
three-digit employee number, 001 to 999, you
would set up a file of 999 records:
DEFINE
FILE
1
(999,XXX, U,NEXT)
If
you read an employee number from a card
77
FORMAT
(14)
READ
(2,77)
NEMP
you can immediately find that employee on the disk
with
or
READ
WRITE
(1 'NEMP)
data
(1 'NEMP)
data
The advantages of this scheme are obvious, but
the disadvantages may override them. In all proba-
bility, although there are 999 employee numbers,
there are not really 999 employees, so there will
be many "holes", or unused records, on the disk.
Furthermore, 999 records, if they are large, may
take up an inordinate amount of space on the disk.
Even
if
they do fit on the disk, they will be spread
out so far that programs using this file will run
very slowly, because of the amount of "seeking",
or disk arm movement, required.
One remedy would be to make the employee
numbers more compact. If there are 300 employees,
why not renumber them from 001 to 300? Or
renumber your customers in a billing file? Or
renumber your part numbers? Or job numbers?
Usually, this is more easily said than done, and
you can expect difficulty in convincing management
that they should change established systems just to
make
it
easier for you or the computer.
Section
Subsections
Page
85
10
I
30
01
Computed Direct
Sometimes it is possible to take an employee
number (or part number, etc.) and modify it to
make a usable record number.
For example, if
you have 300 employees with employee numbers
between 3000 and 9000, you could take this number,
NEMP, subtract 3000, divide by 20 (which is
(9000-3000)/300), and add 1:
NREC
=
(NEMP-3000) / 20
+
1
This results in an NREC between 001 and 301. This
is compact and wastes no space; however, two (or
more) employee numbers may quite possibly result
in the same record number. These are known as
synonyms. There are many ways to handle this
problem, but they require a certain added amount
of programming and disk space.

Advertisement

Table of Contents
loading

Table of Contents