IBM 1130 User Manual page 594

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

Advertisement

Section
Subsections
Page
75
30
I
10
01
Internal Sorting Methods
Internal sorting is defined as the sequencing of a
group of data records contained in the core stor-
age of your 1130.
It
generally involves reading
successive records from disk storage into core
storage, sorting the group in storage by one of
the methods to be described, and then writing the
sequenced group onto disk.
Since internal sorting is generally a part or a
phase of other processing and programs, you' must
distinguish between methods according to the ulti-
mate purpose they serve. Thus, some sorting
routines found in compilers, assembly programs,
and other applications are strictly internal; that is,
a group of items is to be sequenced only in core
storage, not written onto disk. On the other hand,
in most generalized and specific sort programs,
the file of records is too large to be contained, at
one time, within core storage. Here the internal
sort passes serve only as a prelude to the subse-
quent external merge phase of the sort and, hence,
are frequently called presorts or premerge sorts.
The purpose of the internal sort, then, is to form
a number of sequences, or strings, which are
placed into the output and subsequently merged.
The more efficient the premerge sort, and the
longer the strings it generates, the fewer external
merge passes required.
In
addition to the purpose of the sort, the follow..:..
ing considerations apply in selecting an internal
sort technique and evaluating its suitability for a
specific application:
1. Characteristics of the machine (basic proc-
essing speed, internal storage capacity, etc.)
2. Input/ output characteristics (number of disk
drives).
3. Number and length of data records.
4. Length and range of control keys.
5. Degree of original file ordering (natural
sequences) .
6. The associated program.
Since there is no single best method for all types
of applications, most sort programs represent a
compromise between conflicting requirements. In
general, they attempt to incorporate the following
in as nearly optimal a manner as possible:
1. Sort internally as many records as can be
packed into core storage.
2. Minimize total process time per record.
3. Function in a manner compatible with I/O
operations and strive for a maximum overlap of
read, write, and processing time.
4. Utilize existing sequences in the input file,
if possible.
5. Write routines that are compact and that can
be modified easily.
6. In a generalized program, accept and sort
variable length records with any size control key.
Generally, records can be sorted by (1) physi-
cally moving them about until they are in order,
(2) forming tables of record numbers (tags) in stor-
age, which are then sorted, or (3) combining the
control key and record number and sorting the
resulting short key-tag pairs. Either tag sorting
or key sorting is the preferred method today. The
sorted keys are then used as an index to the file.
In addition to an explanation, the advantages and
limitations of each sorting method will now be eval-
uated briefly with respect to major file and machine
characteristics. Additional methods and additional
information on each of the methods discussed may
be found in Sorting Techniques (C20-1639).

Advertisement

Table of Contents
loading

Table of Contents