This is a 32 bit replacement for the handy DOS sort.exe utility as a
Windows dll. Unlike the DOS, however, there is no 64K sort limitation:
it will use all available memory. Another feature is that one can sort
on a specific segment of a record. Records may be variable in length.
No runtimes are required.

Declaration for Visual Basic calling program.

Declare Sub SORTRECS Lib "SORTW32.DLL" (A$, B$, C$, D$, E&, F&)

A$ - Input file path as a dynamic string.
B$ - Output file path as a dynamic string.
C$ - A (ascending) or D (descending) order as a dynamic string. If left
     blank, ascending is assumed.
D$ - Y (case sensitive) or N (not case sensitive) as a dynamic string. If
     left blank, case sensitive is assumed.
E& - Begining position in record for sorting as a long integer. If zero,
     the first character of the record is assumed.
F& - Length of sort from beginning position as a long integer. If zero,
     the entire record is assummed.


Upper or lower case may be used in specifying parameters. 

If the sort is successful, parameter F& will return the number of records
sorted. If an error occurs, an error message box will be displayed and
F& will return a -1 to the calling program.

We've clocked this against the excellent OpTech commercial sort written
in C code and this beats it. In fairness, the OpTech sort can do a lot
more than this or the old DOS sort utility but this is very fast,
reproducable and free. 

Source is included so that if you have the PowerBasic 32 bit Windows
compiler, you can modify the code to accommodate your needs.

Enjoy.

Jill McLeester
www.three-systems.com
 
