TI Sort

From Ninerpedia
Jump to navigation Jump to search

TI Sort is a commercial program written by Dennis Faherty.

Dennis is the father of Chris Faherty who wrote TI Artist Vn 1 when he was aged 14.

A quotation from Dennis:

TI SORT

"The actual sort algorithms were based on a QUICK SORT method described by C A R Hoare in a book titled 'Fundamentals of Data Structures' by Horowitz.

The file handling methodology is a variation of creating multiple sorted files and merging them into the final output. The variation is that a single fixed file is used with sections of this file representing the multiple files. With the limitation imposed by TI on the number of files to have open concurrently, this seemed like a reasonable variation.

It is also designed specifically for TI-BASE files, with other record types also being considered, to make it as generically useful as possible. It was obvious even before TI-BASE was first released that it would probably need a supplemental sort program for data bases of any large size, and I had planned TI-Sort at that time."

(end of quotation)

Sorting TI BASE files with TI SORT is indeed very easy and you don't really need the manual.

The AID key is functional with help windows throughout, should you need them. Just one tiny niggle- when selecting the order of nesting, when sorting on more than one field, the order number is placed at screen left, and is not visible on my tv! Such screen echoing of input is not absolutely needed though.

When sorting TI BASE data, TI SORT accesses the Structure file, and lists the fields for you to select from. And off it goes, making use of an intermediate file, rewriting the old file OR making a separate file it you prefer.

As with another program called SORT1, use of a RAM disk makes life a lot easier, else use of different disk drives speeds things up- eg intermediate file on a different drive to the input/output files.

TI SORT can cope- subject to your media limitations!- with up to 32767 records.

ALL sizes of TI Base records are supported, but non-TI Base data is limited to 255 byte records or under. MAXIMUM of 17 FIELDS PER RECORD.

Nested sorts up to eight deep.

TI Sort will load using the standard Extended Basic LOAD from drive one, or using LOAD AND RUN from drive one, or using machine code RUN memory image file from any drive.

On screen display of the sorting process is optional.

In addition to TI Base data TI SORT can handle other types of data- in every case you must create a structure for the data similar to that a used by TI Base (and similarly by PRK).

This just means you have to tell the program how many fields are in each record, of what type, and how long they are. Structure files so created may be saved for later use either with the same data or with other identically structured data.

FIXED RECORDS- strictly speaking, only the actual fields you wish to sort on must be in fixed positions, but generally it is preferable if all data fields are of fixed length and position.

DELIMITED RECORDS- in which each field varies in length from record to record, and is merely separated from other fields by a special delimiter character, which can be any character you wish, so long as it is not included as part of a data item.

BASIC FILES- files created in a BASIC program, internal or display format. In this case embedded blanks may cause problems eg 'THE RED SKY' as it cannot tell the difference between embedded blanks and blanks between fields.

The program automatically (transparently) switches between three modes, depending on the amount of data- if it will all fit into available ram then 'scratch file' is not used, everything takes place in ram. For example 200 records of 80 bytes would be dealt with in ram.

After we run out of ram the use of sub files takes place, with a third mode available when you go over around 4000 records - but you really don't need to know all that at all!

If you only do a little sorting, there is the fairware program SORT1, with only the barest documentation. Or their is this very friendly program specially written for TI Base, called TI SORT, which I recommend to you.