MEGASORT INSTRUCTIONS - Copyright (C) 1986 by JW LUHRMAN Ver 1.0
 
This is user-supported software. If you find this program useful
please send $10 to
 
J. W. Luhrman                                                  (212) 382-1722
2nd Floor
247 West 38th Street
New York, NY   10018
 
thank you.
 
INTRODUCTION - MEGASORT is a text file sort utility.
 
	     The main features of MEGASORT are:
		The ability to sort multimegabyte files.
		It is fast. Up to 50 times faster than SORT.
		The number of sort keys is limited only the 
		length of the command line.
		Each key can be ascending or descending.
		Fixed or variable length records can be sorted.
		Four output file formats:
 
			STANDARD OUTPUT - Output records are the
			same as the input records.
			LIMITED OUTPUT - Output records are made
			up of portions of the input records.
			TAG OUTPUT - Output records are binary
			pointers to the input records.
			KEYTAG OUTPUT - Output records are the
			sort key(s) plus the binary TAG pointers.
 
REQUIREMENTS - MS-DOS, one disk drive, at least 4K of RAM prior to load.
 
	4K is all that is required to sort small or medium size 
	files with short records, approx. 200 bytes. If more RAM is
	available larger files and/or files with larger records can
	be sorted. Additional RAM, up to 64K, will decrease the
	time required for the sort.
	If the whole file can not be held in memory, then blocks
	of sorted records will be written to a temporary file
	MEGASORT.TMP. These blocks will then be merged into the
	output file.
	You must have sufficient disk space to hold the input, temporary
	and output files simultaneously. Under certain conditions
	the temporary and/or output file can be larger than the input
	file. For standard output the size of the temporary file
	will be the number of records in the input file multiplied by the
	size of the largest record minus two bytes per record.
	If MEGASORT can not merge all blocks in the TMP file at one time
	then the output file will be used as a secondary TMP file. In
	this case you need twice the space calculated above.
	You can save disk space by making the output pathname exactly
	the same as the input pathname. This is NOT RECOMMENDED, if
	MEGASORT should abort for any reason your data will be lost.
 
COMMAND LINE - IN,OUT/?:M#KTL/KEY(S)
 
IN - Input pathname
	Required - A pathname to a disk file.
	Records must be terminated with a LF 0AH. The byte prior to the
	LF must be a CR 0DH, this byte is not checked. You can not sort 
	records with imbedded LF(s), you can sort records with
	imbedded CR(s).
	Tabs 9H are not expanded, you can sort records with tabs.
	An end-of-file 1AH is optional.
	Default extension is TXT.
 
 
OUT - Output pathname
	Optional - A pathname to a disk file.
	Default is the input pathname.
	Default extension is SRT, TAG, or KEY.
 
?: - Drive to be used for the temporary file.
	Optional - A drive specification, A: B: etc.
	Default is the current drive.
 
M# - Maximum record length, including the CR LF.
	Required if the length of any record will exceed the length
	of the first record, M80 M250 M6679 etc.
 
KTL - Output file format.
	Optional - Only one letter can be specified, K, T, or L. 
 
	K - KEY FILE OUTPUT
		The output file will contain fixed length records.
		Each record will contain the sort key(s) for that
		record followed by four binary bytes (LEAST SIGNIFICANT
		WORD, MOST SIGNIFICANT WORD) that specify the starting
		byte of that record in the input file.
		CR LF are not written.
		An end-of-file 1AH is written if and only if the input
		file had one.
		Default extension is KEY.
 
	T - TAG FILE OUTPUT.
		The output file will contain fixed length records.
		Each record will contain four binary bytes (LEAST
		SIGNIFICANT WORD, MOST SIGNIFICANT WORD) that specify
		the starting byte of that record in the input file.
		CR LF are not written.
		No end-of-file is written.
		Default extension is TAG.
 
	L - LIMITED FILE OUTPUT.
		The output file will contain fixed length records.
		Each record will contain only the bytes specified with
		the L option, plus CR LF.
		Example:		L1-17,23,5-9,100-750
		     Each output record will contain only bytes 1 
		     through 17, byte 23, bytes 5 through 9 and bytes
		     100 through 750 of the input record, plus CR LF.
		The output record will contain blanks whenever the bytes
		specified for output are greater than the length of the
		input record.
		An end-of-file 1AH is written if and only if the input
		file had one.
		Default extension is SRT.
 
	Default is standard output. Each output record is the same as
	the input record. Record lengths will vary if the input record
	lengths did.
	An end-of-file 1AH is written if and only if the input file had one.
	Default extension is SRT.
 
 
KEY(S) - Sort key(s).
	Optional - 
	The number of keys is limited by the length of the command line.
	Example:      1-12,17-44,D15-19,33,77-79,A7364,100-200
		The output records are sorted on the following fields:
		ascending order    1-12
		ascending order    17-44
		descending order   15-19
		descending order   33
		descending order   77-79
		ascending order    7364
		ascending order    100-200
	NOTE: The A and D are toggles, once specified they remain if effect
  	      until the opposite toggle is specified.
	      The default toggle is A.
	Default is all characters sorted in ascending order.
	If only the D is specified, no key(s), then all characters are
	sorted in descending order.
 
EXAMPLES - 
 
1.	MEGASORT DOG
	The file DOG.TXT is sorted into the file DOG.SRT.
	All characters of each record are sorted in ascending order.
	No record can exceed the length of the first record.
	The temporary file is written to the current drive.
 
2.	MEGASORT DOG.DAT/D
	The file DOG.DAT is sorted into the file DOG.SRT.
	All characters of each record are sorted in descending order.
	No record can exceed the length of the first record.
	The temporary file is written to the current drive.
 
3.	MEGASORT DOG,CAT/D15-30
	The file DOG.TXT is sorted into the file CAT.SRT.
	Characters 15-30 of each record are sorted in descending order.
	No record can exceed the length of the first record.
	The temporary file is written to the current drive.
 
4.	MEGASORT DOG.XXX,CAT.YYY/C:/D15-30
	The file DOG.XXX is sorted into the file CAT.YYY.
	The temporary file will be written to drive C.
	Characters 15-30 of each record are sorted in descending order.
	No record can exceed the length of the first record.
 
5.	MEGASORT DOG/M100/1-15
	The file DOG.TXT is sorted into the file DOG.SRT.
	No record can exceed 100 characters.
	Characters 1-15 of each record are sorted in ascending order.
	The temporary file is written to the current drive.
 
6.	MEGASORT DOG/C:M100L25-50/1-15,D77-99
	The file DOG.TXT is sorted into the file DOG.SRT.
	The temporary file will be written to drive C.
	No record can exceed 100 characters.
	Characters 1-15 of each record are sorted in ascending order,
	characters 77-99 of each record are sorted in descending order.
	For output record format see LIMITED FILE OUTPUT.
 
7.	MEGASORT DOG/M2000T/D77-99
	The file DOG.TXT is sorted into the file DOG.TAG.
	No record can exceed 2000 characters.
	Characters 77-99 of each record are sorted in descending order.
	For output record format see TAG FILE OUTPUT.
	The temporary file is written to the current drive.
 
8.	MEGASORT DOG/B:K/D63-144
	The file DOG.TXT is sorted into the file DOG.KEY.
	The temporary file will be written to drive B.
	No record can exceed the length of the first record.
	Characters 63-144 of each record are sorted in descending order.
	For output record format see KEY FILE OUTPUT.
 
ERROR MESSAGES - 
 
DISK SPACE -
	Insufficient disk space to sort the file with the specified
	options.
 
IN FILE -
	No input file was specified or the specified file
	could not be opened.
 
KEY(S) -
	Illegal key(s) or illegal format.
 
LENGTH -
	The length of a record exceeded the specified or
	default length.
 
MEMORY -
	Insufficient memory to sort the file with the specified
	options.
 
OPTIONS - 
	Illegal format or options out of order.
 
OUT FILE - 
	The output file could not be created.
 
TMP FILE -
	The temporary file could not be created.
