FILESRT.EXE

Version 2.0a of June 2002
COPYRIGHT © 1996-2002 Norbert H. Doerry

FILESRTA.EXE

Version 2.0a of June 2002
COPYRIGHT © 1996-2002 Norbert H. Doerry


1. Description

FILESRT.EXE and FILESRTA.EXE are utilities for sorting files. Both programs sort based on the value of the field specified on the command line. Spaces or tabs delimit fields. Files can either be sorted alphabetically or numerically. Numerical Sorts first attempt to sort the field by converting the field to an integer, then sort the remaining characters based on an alphabetic sort. FILESRT.EXE can sort very large files because it uses multiple temporary files to store intermediate data. FILESRT.EXE is limited only by the number of files that can be open at once, with each temporary file holding about 3600 records. FILESRTA.EXE may execute faster for files larger than 3600 records, but is limited to files of a certain size (generally much greater than 10,000 records). The actual limit for FILESRTA.EXE depends on the size of the fields sorted on and the amount of available memory. FILESRTA.EXE works by making two passes through the input file. During the first pass, it reads only the field to be sorted on, and the location in the file of the corresponding record. After sorting the fields, FILESRTA.EXE reads lines from the input file in the sorted order and then writes to an output file.


2. Syntax

FILESRT.EXE  INFILE.TXT [-oOUTFILE.TXT] -fXY -?
FILESRTA.EXE INFILE.TXT [-oOUTFILE.TXT] -fXY -?

Where: 
         INFILE.TXT = Name of the input file
      -oOUTFILE.TXT = Results are written to the file OUTFILE.TXT,
                      uses the standard output if not specified. 
      -fXY          = Field to sort on where
                       X = the number of the field to sort on, starting with 1
                       Y = A for alphabetic sorting
                         = N for numeric sorting
      -?            = Provides the Syntax for using FILESRT.EXE or FILESRTA.EXE


3. Comments

Neither of these programs is particularly fast. Both need optimization for speed.

If FILESRT.EXE is used, one should ensure that the files setting in config.sys is set high enough to enable having all the temporary files simultaneously open. The maximum number of records per temporary file is 3000.

Lines in INFILE.TXT should be less than 1024 characters long.

General Guidance: If you have less than 3,600 records, use FILESRT.EXE. If you have between 3,600 and 10,000 records, use FILESRTA.EXE. Above 10,000 records, use FILESRT.EXE. The reason for this guidance is:


This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.


Last Update: June 22, 2002
Norbert H. Doerry: doerry@aol.com