Category : File Managers
Archive   : SORTS15.ZIP
Filename : SORTS15.DOC

Output of file : SORTS15.DOC contained in archive : SORTS15.ZIP
SORTS - A Multi-Key Record Sorting Utility

Version 1.5

by William C. Parke (c) Copyright 1986
for CHUG
the Capital Heath/Zenith Users' Group


SORTS is a record sorting program for MS-DOS computer systems.
It will sort records from files larger than 64K in size, with
tens of thousands of records (depending on the memory in the
computer), sorting on an arbitrary set of key fields selected in
any order. Record lengths can be variable, with up to 255
characters in each. The sorting keys can be from one to 255
characters long, taken from columns in the records in any order.
Often used key-column orders can be saved within SORTS and
recalled by a single letter name. Any part or parts of the key
can be selected for reverse order sorting.

The advantages of SORTS are the following:

1. Speed: SORTS was written in assembly language and it
performs its sorts in memory, making its operations very fast
relative to many other sorting programs.

2. Capacity: SORTS can handle files with approximately 30,000
records and up to a 7.5 Megabyte file.

3. Flexibility: SORTS can perform multiple field sorting based
on a selection of columns making up a sorting key. Each selected
column can be sorted in reverse order or normal ASCII order.

4. Ease of Use: SORTS can save up to 8 set of columns used for
a sorting key. This setting can be recalled by a single letter.


SORTS is use to arrange records in a file in numerical and
alphabetical order, starting at any position in the record, and
using an arbitrary set of columns to perform the ordering. A
record is any set of characters terminated by a carriage
return/line feed. SORTS does not require the records be of fixed
length, but they must not exceed 255 characters per record.

SORTS is handy for sorting disk catalogs, name directories,
numerical data, address lists, etc. based on selected key fields
within the records. It is probably the fastest multi-field
sorting utility available. It gains speed by using all of the
available free RAM (up to the 640K limit on MS-DOS machines). It
will not operate on files with more than about 30,000 records.


The command syntax for SORTS is:

SORTS oldfile newfile [/t][/sx][/c1-c2,c3,...]

oldfile is the name of the file which stores the unsorted
records (with optional path name prefix),
newfile is the name of the file you wish to use for
storing the sorted records (newfile may also
contain a path name prefix);

t is an optional toggle:
t= C will make SORTS ignore the case of letters while

s is an optional selection:
s= Sx indicates that the column order which follows is
to be saved and given the name 'x',
s= Ux indicates that the previously saved column
order 'x' is to be used for the present sort;

c1-c2,c3,... are optional column numbers, starting at 1
for the first column in the record. The pair c1-c2
makes the columns from c1 to c2 (inclusive) part of
the sorting key. The single value like c3 above
adds the single column at c3 to the key. If no
columns are given, a default of columns 1-12 is
If an R appears in front of any pair of column numbers
(or in front of a singular column number), that
column range (or single column) will be sorted in
reverse ASCII order.


1. Getting a reminder of SORTS' syntax and stored fields:


will give a brief help screen indicating the syntax for SORTS and
will show the current names and values of the stored column
orders to make key fields. This same help screen is shown
whenever a command line syntax error occurs. The initial settings
for the stored column orders match the columns used in the
companion program CATS, used to catalog a large number of files
on multiple disks.

2. Sorting by default:


will sort the records in the file NAM.REC, using the default
first 12 columns of each record as a key field. The sorted
records will be written to NAME.REC.

3. Sorting with new key field:

SORTS FOO.BAR FOOD.BAR/8-10,r1-3,40,43,50-60

will sort the records in the file FOO.BAR, using a key based on
the columns:


in that order, in FOO.BAR. This operation will produce a file
FOOD.BAR with all 'A's in column 8 before 'B's, etc. For each
record with a given sequence in columns 8, 9, and 10, records
with a 'Z' in column 1 will come before those with a 'Y', etc.
Specifying multiple columns in this way has the effect of
performing a multiple number of sorts on each key subset,
preserving the previously sorted fields.

4. Defining a new key field column order:

SORTS /Sa/r14-15,1-8,10

will save the column order settings r14-15,1-8,10 into a buffer
in SORTS with the name 'a'. (The 'a' can be in upper or lower
case.) This setting can be reviewed with the command SORTS with
no command tail as in the first example above.

5. Defining and operating with a new key field column order:


will save the key columns 20-24,1-8 with name 'm' and then sort
the records in MAY.DIG according to this key.

6. Ignoring case while sorting:


will sort the file CATS.DIR in the directory called CATS, using
the previously set column order named 't', and ignoring the case
of the characters.

7. Erasing a previously defined column order:


will erase the column order labeled 'a' from the storage buffer
in SORTS. This will make space for a new column order with a
different label.


After the program begins, SORTS will show the key field columns
it will use for the sorting. It then calculates and displays the
total number of records which could be sorted with the given key
field length, assuming resident programs are not loaded into
memory. SORTS follows by showing how many records can be sorted
with the current free memory. Next, the output file is opened.
If it already exists, you will be asked if you wish to overwrite
it. Then, the key fields of the file records to be sorted are
read into memory. SORTS will display the total number of records
it has found, and check if enough memory is available to perform
the sort. If so, the sorting is done in memory. The file is re-
read in record sorted form to be written to the output file.


Key field lengths from 1 to 12 will permit the largest number of
records to be sorted. With a total key field length of 13 to 28,
only half that number can be sorted. When picking columns by
examining sample records to be sorted, try to keep the total key
field length in the 1-12 range. If this is not possible, you
should then try to use less than 29 columns for the key field.
For example, if a record had the following format (column numbers
are given above record):

1 2 3 4 5
FOOBAR EXE 89984 83/11-30 01:23 DISK 000001\.........

then sorting on the date and time field (24-37) can be done with
the key columns set to either 24-37, or 24-25,27-28,30-31,33-
34,36-37. This second choice eliminates the '/', '-', and ' ',
and ':' characters which are repeated in every record and do not
affect a record sort anyway. Instead of (24-37), which has a key
width of 14, the segmented set has a width of only 10, leaving 2
more columns available to make a 12 or less character key. Note
that SORTS starts column numbers at 1 rather than 0.

For some purposes, a restricted sub-key field produces a more
interesting sorted file than a wider field. With records in the
format of the above example, taking the 'year' field (columns 24-
25) rather than the full date (columns 24-31) as the first part
of a column order, such as 24-25,1-12, produces a sorted file
with all records in one year grouped together and then
alphabetized by the names in the columns 1-12..


Column order "x" in use. Overwrite it ?
The selection /Sx was made for a column order already

Column order "x" not found.
The selection /Ux was made for a column order not yet

Column syntax error.
The format of the /c1-c2,c3,... column order was not
correct. See the examples above for the correct syntax.

Erase column order "x" ?
A request to overwrite a previously define column order
was made with the /Sx selection.

Error opening [filename]
The input file specified was not found.

Error Reading file
An error occurred in attempting to read the input file.

Error Writing sorted file
An error occurred in attempting to write the output file.

Insufficient memory.
SORTS did not find enough free RAM for its required file

Invalid DOS Version.
SORTS requires MS-DOS 2.1 or above.

Maximum 16 column pairs exceeded.
Too many column pairs were given on the command line.

No free new column space.
All of the column order settings have been defined. Use
the /Sx/0 command to erase one of them.

Output file already exists. Overwrite it ?
Overwriting the output file will destroy any previous
data in that file. The input file is unaffected.

Output file cannot be input file.
The output file was given the same name as the input
file. SORTS cannot operate on just one file.

S selection requires column order.
The /Sx selection must be followed by a column order
definition: /c1-c2,c3,...

SORTS.COM not found.
If a /Sx selection is to save a column order, SORTS must
be able to find itself on the disk.

U selection takes no column order.
The /Ux selection uses a previously defined and saved
column order definition. No /c1-c2,c3... should follow
this selection.


This program was inspired by a sorting utility by Vernon Buerg.
Jerome Horwitz and Douglas Clark in CHUG gave suggestions and

Copyright Status:

The author retains all legal Copyrights to the program SORTS Version 1.4.
However, he grants individuals licence to use this program, and permits
non-profit and non-commercial distribution of the program.

Please send comments to:

William C. Parke
1820 S Street NW
Washington, D.C. 20009

  3 Responses to “Category : File Managers
Archive   : SORTS15.ZIP
Filename : SORTS15.DOC

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: