'Sort' - Database Sorting Program
*** Written by Dr Jason Wolfe ***
Copyright © Jason Wolfe 1993-2001 (Version 1.18)
[ Compatible with Psion Series 3a & 3c. (Not Series 3). ]
Updates of this program are available on-line at http://www.jwolfe.clara.net
'Register' this program.
Boring Legal Message
This Program is distributed as 'Shareware' - This means it may be freely
copied and distributed. However if you find the program useful, you are
REQUIRED to register
yourself as a user of the program, and INVITED to contribute an appropriate
registration Fee. The registration fee is not compulsory and is basically
what you think the program is worth.
|
WHAT THE PROGRAM DOES : The Program takes a Data File in any format, and sorts it. |
RUNNING THE PROGRAM :
On running the program, you are presented with a standard Psion
Dialogue Box from which you can make various choices.
The 'Sort by' option has 4 options: |
1. | Sort by 'First Name' is a standard alphabetical sort. |
2. | Sort by 'Surname' will search each record for the last word in the
line and use that word as the basis for the alphabetical sort. Note that with hyphenated double-barrelled surnames, it is the first of the two names which is used as the word for sorting. Secondly, where someone has a 'preferred name' rather than their real name, I place this in the 'Data' file entry in brackets after the true surname. Eg. Paul Gascoigne (Gazza) . It is the true surname, not
the preferred name which is used for the sort. If there is only one name in the line, then thats what it will sort ! |
3. | Sort by 'Number' will do a numerical sort on the Data file in
question. The default option here is ascending numerical sort - ie.
1, 2, 5, 7, 9. The only thing to remember when entering your numbers into the Data file, is to enter 'zero' as '0'. If mistakenly enter enter a number as the capital letter 'O', then the program will get confused. |
4. | Sort by 'Date' will sort the records into ascending 'Chronological Order'. The Date should take the form 'Day.Month.Year', for example 25.9.94 or 25.9.1994. As I have shown, the year can be just the last two numbers (94) or the whole year (1994). The date divider can be any non-numerical character - usually a full stop (.) or a slash (/), but theoretically it can be anything you choose, for example 25.9.94, 25/9/94, or 25*9*94. The program will not be able to sort dates in the format 25th Sept 1994. |
Other Sorting Options :Direction of Sort
The program will 'by default ' sort fields into alphabetical or
ascending numerical or chronological order. If you wish to sort
the file into 'reverse' alphabetical / numerical / or chronological
order this can be done by specifying 'Reverse Sort' on the start
menu. This is not an advanced 'Reversed Sort calculated on the
screen as you go' , since this is technically very difficult due to
limitations in the OPL programming language. It merely reverses
the order of the data file once it has finished sorting it in the
normal way.
Number of Field
Since the Word / Number / Date may not always be in the top field of the
database entry, you can choose which field to carry the sort out on.
This is shown in the dialogue box as the 'Number of Field'. If the object
you want to sort is in the second field down, you would change the
'Number of field' to '2'. |
INSTALLING THE PROGRAM
|
CUSTOMISING THE PROGRAM
If there is a file which you sort all the time, and you hardly ever sort
any other files, then you can set up the program to sort that file by
default and also change the sorting options to the ones you always use.
|
REM ********************************************************************
The Default Filename
file$="Dummy"
Adds the File Suffix and Sets the Default Location where Files are
Found. Only change the Default Path if you know how - Consult the
Manual.
file$=file$+".dbf"
SETPATH "M:\Dat\"
Default Sorting Option
(1 = First Name/Word. 2 = Surname. 3 = Number 4 = Date)
sort%=2
Default Sort Direction (1 = Forward. 2 = Reverse)
direc%=1
The Default Field which will be used for Sorting
field&=1
The Default Number/Date Prefix (Only necessary for Numerical/Date
Sorts). Leave this option null ("") if you don't want a default prefix.
prefix$=""
REM ********************************************************************
HINTS & TIPS
1. | To break out of the Program while it is running: Press <Psion Esc>. |
2. | The program 'ought' to work on the Psion Siena, but I have not tested it on this. |
TROUBLESHOOTING
1. | If there is an error of Layout relating to the sort, then the Program will stop and advise you what type of error has occurred and, if appropriate, the name of the entry to which the error applies. You should then correct the entry as appropriate. |
2. | Each individual Psion Series 3a or 3c 'Data' record can be up to exactly
4K long. The maximum length of record for the Psion Series 3 was 1K.
Similarly, the maximum length of a single line in a Series 3a & 3c
record is 1K. The maximum length of a line on the Series 3 was
256 bytes or characters (a quarter of 1K). Psion in their infinite wisdom forgot to update the OPL programming language to allow for these increases in record size. This means that if you try to access a Data file which has any record greater than 1K in length using standard OPL routines, or any line which is longer than 256 bytes, the OPL program will crash. If the record is longer than 1K, the error flashed on the screen is 'Record too long'. If this is the case, I cannot even access the file at all - the OPL programming routines won't allow me to do so. There are ways around this by using machine code and direct file access, but I don't have access to these methods because I don't have the 'Psion Developers Toolkit', which costs 200ukp. You will just have to search through your Data file for records which seem to be too long and shorten them. If a line on the record is greater than 256 characters long, then the error flashed on the screen is 'String too long'. Here, the operating system does allow me to access that particular file, so I can tell you which is the offending record. The solution is to go back to your 'Data' file and shorten that particular line of the offending record. Fortunately, these errors are very rare under normal Psion use. |
3. | This program does not intrinsically suffer from the 'Millennium bug'. However, if you store your dates using only 2 digits (98) rather than 4 (1998) (and its up to you if you do!), then a 'sort by date' which which has entries on both sides of the millennium will get it wrong. If you use 4 digits, it will get it right. |
5. | IMPORTANT NOTE : When sorting a file, please ensure that there is at least an equal amount of free memory as the length of the file you are sorting, on the disk that the file is on. This is to do with the way this program sorts the file: Every entry which is sorted is appended to the end of the file, extending its length. The file is only compressed when the sort is finished. If the Psion runs out of memory in the middle of a sort, then the sort will fail. |
MY OWN IDEAS FOR IMPROVEMENTS
1. | Improve the GUI (Graphical User Interface). |
2. | Activate the 'help' key within the program. |
3. | Allow hierarchical sorts with multiple fields. |
4. | Sort the file using 'direct access' rather than OPL subroutines, which will bypass the '1K / Record' & '256bytes / Line' limitation |
Related Programs
Thats all. Happy sorting. (Please send all bug reports and suggestions to my email address). © Dr. Jason Wolfe (1993 - 2001) |
To contact me : Email
My Website is at http://www.jwolfe.clara.net. You're already there !!
Back to Top of Homepage
Last Modified : 31st March 2001