Download AMOS Basic XCALL subs

Transcript
4
BASORT — XCALt. SUBROUTINE FOR SORTING
2.2.2
FILES
Page 2—6
Sorting Sequential Files
When you sort a sequential file,
you must specify both
an
input
and an
output
file.
If you wish to sort a file back onto Itself,
you
may
specify
the same file for both input and output.
IMPORTANT NOTE:
Before BASORT is called, the file must be opened
for input.
BASORT leaves the file open for output.
Call BASORT for sequential files via:
XCALL BASORT, INPUT'CHANNEL, OUTPUT'CHApEL, RECORD'SIZE,
KEY1 'SIZE, KEVI 'POSITION, KEYI 'ORDER,
KEY2'SIZE, KEY2'POSITION, KEY2'ORDER,
KEY3'5IZE, KEY3PO$ITION, KEY3'ORDER
Where:
INPUT'CHANNEL —
OUTPUT'CpjA
The file channel on which the input file is open.
— The file channel on
which
the
output
file
open.
RECORD'$IZE
—
is
The
size, in bytes, of the Largest record in the
file,
including
the
terminating
carriage
return/tinefeed characters.
NOTE:
Too small a
value results in truncation of data records.
The size,
KEY1'SIZE —
in bytes, of sort
key #1.
Give the
size of the largest instance of key #1 (i.e., if
sort key #1 is the customer's name, find the
longest
name in any record, or perhaps at low for
a very long one).
KEY1'POSITION —
The first character position occupied by key #1.
If
the KEY1'POSITION variable given is SO, for
example, BASORT will, fit the characters beginning
at the fiftieth byte
in
the
record
into
the
sequence it is creating.
KEY1QRDER —
Sort
order of
key #1.
Enter the digit 0 to
indicate that you want key #1 of each record to
be sorted
in
ascending
sequence, or enter the
digit 1 to indicate descending seqeuence.
(NOTE:
The order is determined using ASCII collating
sequence;
e.g., alt
upper—case
Letters come
before lower—case letters.)
KEY2'SIZE —
The size, in bytes, of sort key #2.
KEY2'PO$ITIOPI —
The first character position occupied by key #2.
KEY2'ORDER —
Sort order of key #2.
KEY1 'ORDER, above.)
Enter a 0 or
a
1.
(See