%CO:A,12,72%SORT-A.doc

     The <>BSO facility in PipeDream well illustrates the old adage 
that in computing you can save either time or memory, but seldom both. 
Indeed it is tempting to suppose that BSO stands not for Block SOrt but 
B***** SlOw! On relatively short columns it is tolerable, although even 
five minutes for 100 items is no express, but once one tries to sort a 
large document the exponential increase in the time it takes makes it 
virtually unuseable (hoping to be able to tell you how SORT-A compares 
over a range of column sizes I set BSO to work on a 200 row by 5 column 
one but gave up after 20 minutes - this program had its origins in 
Philip Hodson,s need to sort an 1100 row by 5 column document and he 
left BSO running for 18 hours before giving up - SORT-A did his 
document in an hour).
     SORT-A, then, despite being a simple BASIC program is a lot faster 
than BSO, but it does have some limitations of which you should be 
aware:











































     Richard P. Boam, The Old Post Office, Rusness, Sanday, Orkney 
KW17 2BP. (Club No: 2891)
%CO:B,12,60%
















  1) it can only sort on the first column of the document 
so you may need temporarily to move the column you want the 
sort to be done on to the first column. 
  2) the document to be sorted must consist only of the 
block to be sorted - use save marked block to get the 
block to a separate file if necessary. (see 6)
  3) the last row in each of the columns must contain a 
reference of some sort - insert a dummy entry such as !,|,* 
or whatever. 
  4) it achieves its speed in comparison with BSO by 
throwing memory at the problem. If you have an expanded Z88 
(128K of RAM or more in slot 1) the instantiation of BASIC 
in which SORT-A is running will have 40K available to it so 
provided none of the columns exceeds about 30K it will be 
O.K., (the document can be as long as you like within this 
limit on the size of the largest column) but an unexpanded 
machine will only have 8K so a column of over 4K may cause 
problems. 
  5) SORT-A can be used to sort into the document it is 
sorting, but if you have any fears that you will run out of 
memory make sure you have a copy of the document in a safe 
place before doing this because if it runs out of memory 
you will be left with a mess with some columns sorted and 
others in their original order. 
  6) if you have a 6 column document and set it to sort 4 
it will cope with this and leave the last 2 unsorted, 
though if you are sorting into a different file you will 
have to transfer them across using insert at slot. 
  7) it can only(!) cope with 65535 rows (let me know how 
long it takes) but any number of columns.
  8) while it is fast in comparison with BSO do not be 
fooled by the rate at which it clocks up the rows when it 
is first started - it slows down as it gets further into 
the document. If I get to know that you are finding it 
useful (and how will I do that if you do not write?) I 
might be persuaded to rewrite it in assembler to speed it 
up (offers of money are great persuaders!)
  9) unlike <>BSO, it is possible to escape out of a sort 
in SORT-A. This is fine if that is what you intend to do, 
but could be frustrating if you do it accidentally during a 
long sort so put your Z88 out of harms way while it is 
running SORT-A.
%CO:C,12,48%%CO:D,12,36%%CO:E,12,24%%CO:F,12,12%