home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.whtech.com
/
ftp.whtech.com.tar
/
ftp.whtech.com
/
club100
/
txt
/
zipsrt.doc
< prev
next >
Wrap
Text File
|
2006-10-19
|
7KB
|
197 lines
ZIPSRT.DOC (c) 1989 Wilson Van Alst, all rights reserved.
CONTENTS
--------
I. Introduction: a list of ZIPSRT features
II. Running from MENU: the "ordinary" way to sort files,
sorting by column, and skipping headers
III. Technical Notes: memory usage, best and worst-case files,
and what the program won't do
IV. Acknowledgements: because there is a rich legacy here
I. Introduction
A. ZIPSRT is a sorting program for .DO files in the M100/102 and
T200 computers. It features:
1. machine language speed
a. twice as fast as SORTHI.CO on large random files
2. sorting by column
a. sorts data tables based on any field
3. sorting "in place"
a. will handle very large files because it does not
duplicate the file being processed
4. sorting lines of any size
a. can even resequence entire paragraphs within a .DO file,
if the paragraphs are numbered
5. sorting from a specified line
a. lets you exclude "headers" from the sort
6. easy access from BASIC
a. including the column sort feature
7. operation in the AltLCD buffer
a. no need to CLEAR or change HIMEM
II. Running ZIPSRT.CO from the MENU
A. Put the cursor over ZIPSRT.CO and press <ENTER>
B. The program will display a list of files, and ask you to name
the one for sorting
1. you may enter the name in upper or lower-case
2. you may include a .DO extension, but you don't have to
3. if you respond with no file name (i.e., by hitting just the
<ENTER> key), you'll return to the main MENU
4. if you make a mistake and type in the name of a
non-existent file, one of two things will happen:
a. if the file name was "legal," you'll return to the MENU
and find that the file has been created -- with nothing
in it
1) this is not a problem for the computer, but you
should KILL the file to get rid of clutter
b. if you gave an "illegal" file name (too many characters,
for example), you'll see the BASIC "Ok" prompt
1) you are, in fact, suddenly in BASIC -- but the
function keys will not be working
a) type MENU, followed by the <ENTER> key, and you'll
return to the MENU, with no harm done
C. Once you give a valid answer to the file-name prompt, the
screen shows the first line of your file, with a "ruler" below
it.
1. If your first line of text is:
"Last name First name State"
you will see:
Last name First name State
^^^^|^^^^|^^^^|^^^^|^^^^|^^^^|^^^^|^^^^|
Col?
2. You respond to the "Col?" prompt with a number based on the
=screen position= of the column you wish to sort
a. to sort from the start of every line, you answer 1
b. to produce a sort based on "First name" in the above
example, you would enter 14
c. to sort from the start of "State", you would enter 30
3. You cannot enter a number that's larger than the longest
record in your file
a. i.e., it makes no sense to sort on a column that doesn't
exist
1) if you try, you'll return to the main MENU with no
changes made
4. If you respond with 0, or just the <ENTER> key, the program
will repeat the ruler display -- showing successive lines
of text every time you hit <ENTER>
a. The actual sorting will begin with the last line of text
on the screen when you specify a valid column number
1) earlier lines in your file will not be sorted
2) this is a useful way to cycle past "headers" in the
file and start the sort in the actual data fields.
D. While it's sorting, the program will flash a cursor on the
screen to let you know something is going on.
III. Technical Notes
A. Though ZIPSRT works on files "in place," it does need some
free memory in the computer for a buffer
1. this overhead is established as the length of your file's
=longest= string, plus 50 bytes.
a. if there's not enough room, you'll return to the MENU
without changing anything
B. ZIPSRT's column sort feature will not work on files where
columns are created with TABs instead of spaces
1. sorts that start at Col. 1 are not affected by this
limitation
2. I could not fit the math for "justifying" TAB files into an
AltLCD program
3. BASIC programmers who want to create text files for column
sorts should use the PRINTUSING command, because it aligns
columns with spaces instead of TABs.
C. Every sorting method has a "worst case" file structure
1. for ZIPSRT, this is when a record near the top of the file
belongs at the end of the file
a. if you are adding data to a large file that's already
sorted, put the new data at the bottom (as the BASIC
APPEND instruction would normally do)
1) ZIPSRT is optimized for this method of adding to a
file.
IV. Acknowledgements
ZIPSRT is dedicated to Rick Perry, a legendary contributor to
this forum and one of the pioneers in recognizing the M100 as
a true computer. Several years ago, Rick wrote the machine
language sort program that has evolved into the SIG's current
'standard,' SORTHI. Though I did not borrow from Rick's code,
he inspired the idea of a fast, small "in place" sort routine,
and ZIPSRT is built on that foundation. Further thanks go to
Robert Covington, author of the invaluable ROM maps in Library
8, and to James Yi and Phil Wheeler, who have extended
Covington's research and documented many additional routines
in the M100/T200 ROMs. In addition, Randy Hess offered
helpful suggestions on the way ZIPSRT should "feel" to the
user, and Randy's sense of humor was wonderful tonic for the
cold-starts and various other frustrations that go along with
machine language programming.