Jason Wolfe's  'Match'  Homepage

***   Written by  Dr Jason Wolfe   ***

Copyright     ©    Jason Wolfe   1994-2001     (Version 1.35)

[ Compatible with Psion Series 3a & 3c. (Not Series 3). ]

Updates of this program are available on-line at   http://www.jwolfe.clara.net

     Download Match Package now ...

Match OPL File  +  Dummy File  +  Help File  (Zip File).

     Some Sample Screenshots ...

Match Screen 1
Match Screen 2
Match Screen 3

     View Sample Printouts ...

List of all the patients in the 'Dummy' file

List of those patients in 'Dummy' who had
List of those patients under consultant 'Forster' who had 'Chest Infections'
Patients who had EITHER 'Chest Infection'  OR  'CVA'
Patients who were NOT under the consultant 'Forster'
Patients who were NOT under 'Forster' and NOT under 'Jordan'
1 AND (2 OR 3)
Patients under 'Forster' who had ( EITHER 'Chest Infection' OR 'Angina' )
1 AND 2 (NOT 3)
Patients under 'Forster' who had 'Complications' ( which WEREN'T 'Chest Infections )
1 OR 2 (NOT 3)
Patients who had 'Chest Infections' OR 'UTI's' ( who WEREN'T under 'Forster' )
1 NOT 2
Patients who had 'Complications' and who were NOT under 'Forster'
1 NOT 2 NOT 3
Patients who had 'Complications' and were not under 'Forster' and NOT under 'Jordan'

The patients in the dummy file have for the most part have real diagnoses, but the names, hospital humbers, dates of birth, dates of admission and dates of discharge have been changed to protect their identity.
(Note that it appears that most of the printouts are so wide that they could never fit on one page, but this is achieved because with Epson & Hewlett Packard printers, control codes are sent to the printer which make the output condensed.  Thus, all of the important details such as name, hospital number date of birth, date of admission, and sometimes date of discharge are seen at a glance on one line, whilst the diagnosis is placed in a column next to these details.  Basically, the real thing looks even better.)

'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.

Registration entitles you to free technical support and upgrades.  If you have any genuine questions about this program or need any alterations made, I am contactable by email using the address above.  For major alterations or rewrites I may charge a suitable 'Consultation Fee'.  Please DO contact me to  register , even if you do not intend paying, as I am anxious to find out how many people are out there using my program.

You may not change ANY part of this program or use ANY part of it in any other products without my express permission. The program must be distributed in its entirety, with the 'help' file and 'dummy' file included. This Program is Not Public Domain.

(You can of course change the program variables relating to the Filename, Search Parameters, and various Printer & Formatting Defaults)

Finally, this program is supplied as is. I cannot be held responsible for computers crashing, patients dying, the world ending, and the like.  You use the program at your own risk.  All I know is that it works on my Psion fine, has helped me a great deal, and has never damaged anything.


The Program is written for Doctors.  It takes a standard Psion Data File which you have set up to contain patients' details, and carries out various searches on the data in the file, finally producing a tidy printed copy of the results.   It was designed to assist in the sometimes laborious process of Medical and Surgical Audit.

It is part if a package of three programs called  'Listpat',  'Match' &  'Sort' , all of which are designed to assist you in Maintaining,   Manipulating,  Searching  and  Sorting  through your Patients'  'Psionised'  records.

Listpat Match Sort


You will need to keep an up to date record of your patients on your Psion.  I update my records on a daily basis.  You will need to ensure that the information you enter into the database is relevant to the searches which you will one day want to make on it.  Thus if you are going to be auditing all your complications, you will need to enter them into the database when they happen and introduce each complication by some 'identifier'.  I introduce all my complications by the identifier "Comp - ", which means that it is very easy to find them when the database file is searched at a later date.

Many different searches are possible with this program, and most of them are demonstrated in the 'Sample Printout Files' which are available above.  As you will see, the program is able to answer many of the questions that you would ever want to ask whilst doing audit.

The only thing that you will have to ensure is that you keep the information in the Data file in the same format as I have set out below.  The program depends on this to be able to carry out the searches and display the results correctly.

Runing the program is a simple process of selecting your options from a dialogue box menu, and then pressing '<Enter>'.

If a printer is connected, then the Program will detect it, and send the appropriate codes to the printer.  Three printer Drivers are already installed : One for Epson Printers, one for Hewlett Packard, and one for Canon Printers.  If you do not have any of these printers, and your printer is definitely incompatible, then the 'General' Printer Driver should work for practically all printers, including Laser Printers.  Note that the printer drivers have been written to output data via the parallel port cable and so won't work with a serial port printer cable.  You will need a 'parallel' printer cable to print direct to a printer.

If you do not have a printer and you wish to transfer the formatted document printout to another computer, then you can choose the option 'Print To File'.  This file can later be transferred to a PC or Macintosh using the appropriate serial link software.


Transfer the file 'match/opl' to the OPL Directory on your Psion using whichever transfer program you have.  On PC's this will be 'PsiWin', on Macintosh's it will be 'PsiMac', and on Acorns it will be 'PsiRisc' or the 'A-Link'.  It is also suggested that you also transfer the file named 'Dummy/dbf' to the DAT Directory on your Psion, since this file shows the format of database file which Listpat expects to see.

Once the file is loaded onto the Psion, view the file in the OPL Program editor.  Before being able to run the program, you will need to 'Translate' the file into a OPL 'run' file.  This is very easily achieved by pressing <Psion-T>, or you could also select translate from the program menu.  This will create a new version of the program which the Psion can 'run' - It may take a minute or so for translation to be finished.  Finally, once it is finished you will be able to run the program.

The program is set up so that it should immediately be able to work on the attached 'Dummy/dbf' file, and it is suggested that you both look at the 'dummy' file in the database application to check the format the program expects to see, and experiment with Match's handling of the dummy file to see exactly how the program works.

The Dummy file contains the details of 50 patients with real diagnoses, but all identifiable information such as names, hospital numbers and dates of birth have been changed to protect their identities.


The data file should take the format of :-

Name                                    (Eg. Joe Bloggs)
Hospital number                         (Eg. 1234567)
Ward & Bed Number                       (Eg. Harvey G4)
Date of birth (Age) & Sex               (Eg. 3.6.24 (70) M)
Consultant                              (Eg. Finley)
Date of Arrival  -  Date of Discharge   (Eg. A2.3.94 - H4.5.94)
Diagnosis                               (Eg. Munchausen Syndrome)
Notes  (Will register 16 lines)         (Eg. Discharge ASAP)

In order to create a 'Data file' of this format, you will have to carry out the following operations :
1. Go into the system screen and place your cursor over the 'Data' application.
2. Press <Psion N>, which will create a new database file.  Give the new file a name.  (I call mine "Pat" for current patients, "Old" for discharged patients, and "TCI" for those patients still awaiting admission).  Then press <Enter> to enter the Data application.
3. Now press <Psion L>, which will allow you to edit the field labels.
4. Allocate the labels as follows and then press <Tab>.

   Hosp No:
   Age Sex:
   Px Stat:
   DA & DD:
   Dx & Mx:
5. You are now ready to start entering patients' details.
See the attached file 'Dummy/dbf' for examples.  It has 50 patient records, most of which have originated from real admissions, but some of which I have created out of thin air.  All the names, hospital numbers, and dates of birth have been changed to protect the innocent (and prevent me from being prosecuted under the Data Protection Act).


1. The Name can be any length, but will be clipped to 18 Characters.
2. The Bed Number is Optional and should be separated from the ward by a Single Space.  (Eg. "Fleming B3" )
3. All Dates take the Format : Day.Month.Year  (Eg. 1.4.94 or 1.4.04)
The Year should be two numbers only - NOT  4 or 1
(NOT 1.4.1994 or 1.4.4).
The Date Separator should be a Full Stop - Nothing else is allowed.
4. By Convention, Dates of Admission are Preceded by a Capital 'A'.
By Convention, Dates of Discharge are Preceded by a Capital 'H'. (Home)
By Convention, the DOA & DOD are Separated by the '2 Spaces, a Hyphen sign, and then another 2 Spaces. (Ie. "A21.1.95  -  H25.1.95")
5. By Convention, a patient which has died is entered on the Dates Line as
'RIP H' followed by the date they died.  (Eg: RIP H4.7.94)
This enables the Program to pick this up, and append the information to the end of the Diagnosis / Notes Line.  (Rest In Peace)!
6. By Convention, if a Patient is admitted more than once, then each
admission should be on a Separate Line.  This is achieved with the use of <Shift Return> in the Data File.  In this case, both the Dates Line and the Diagnosis Line should be introduced by the Number of the Admission, a Full Stop, and a Single Space.
Eg: 1. A1.4.94 - H4.4.94
    2. A3.5.94 - H9.5.94
or: 1. Chest Infection
    2. Deep Venous Thrombosis
7. If there is a note relating to the Date of Discharge, then this can be entered in Brackets after the Date of Discharge on the Dates Line.
Eg:  A1.7.94 - H4.7.94  (Plan Home).
Eg:  A14.7.94 - H22.7.94  (Transferred to rehab ward)
This note will be appended to the end of the Diagnosis / Notes Line.
8. If there is extra information on the Consultant Line which is in addition
to the Consultants Name, then this too will be appended to the end of the Diagnosis / Notes Line.  This might be useful for example for storing specific Audit Information.
Eg.  Forster Postop Major
(Forster is the consultant, the rest means the patient is postop and the operation was classed as major.)
You can enter any audit information you want on the consultant line.
9. To Enter information on more than one line (in the Data File), but keep that information still under a Single Label - Use <SHIFT RETURN>.
10. Each Label can contain up to 255 Characters  -  Any more will confuse the Program and cause errors.  (The reason being that Characters over the 255 character limit are treated by the Database Program as if they are associated with the next Label down).
If there is an error of Layout, the program will stop and advise you on which Patient the error is associated with.  You must exit the program, correct the Layout in the Data File, and then try again.

Please use the Conventions I have mentioned above  -  The Program relies on finding those particular layouts to work correctly.


To alter the default options of Program such as the default Filename, the default search options and the default printer, you will need to alter a few details in the program.  These are all found between the two sets of  ******** Asterisks ******** 's  close to the beginning of the OPL file, in the program editor.

Change all the details as necessary and when finished, you will need to translate the program again into run code.  This is done by pressing <Psion T> as explained above in the section on installation. Once this is done, your program will be fully customised and to run again.

The following section is a direct copy of the OPL programming code, so you will be able to see what you will need to change in the actual OPL file for customisation prior to running.  Every aspect which will ever need to be customised can be found between the two sets of asterisks.  I wouldn't advise changing anything else in the program unless you are an experienced programmer, and besides, it is against my copyright!

Here follows the OPL section :-
REM *********************************************************************

The default name of the data file which contains the Patients
My default file is called 'Pat', but you can use whatever you want.


Adds the File Suffix and Sets the Default Location where Files are
Found.  Only change this Default Path if you know how - Consult the Manual.

REM The Default Strings


REM The Default Case Sensitivity
REM 1  -  Case Insensitive,  2  -  Case Sensitive


REM  Default "Logic Operators" (AND / OR / NOT) for the search
REM 1 - AND   2 - OR   3 - NOT   4 - 1 AND (2 OR 3) 5 - 1 AND 2 (NOT 3)
REM 6 - 1 OR 2 (NOT 3)      7 - 1 NOT 2      8 - 1 NOT 2 NOT 3


The Default Printer
General = 1,  Epson = 2,  Hewlett Packard = 3,  To File = 4


REM ******************************************************************


1. Select your choices from the initial menu, and then press <Return>.
Thats all.  It's as simple as that.
2. If a printer is connected, the program will send the information to the printer.  If no printer is connected, the text is just outputted to the screen.  See note at the end of this file about switching off serial port communications.
3. The initial Dialogue Box Menu is like any other Psion dialogue box.

Choose the file to list using the cursor keys.  You can also navigate around the filing system to choose files in different directories by pressing <Tab>.
4. The  3  Strings :

The whole program revolves around finding and matching different 'Strings' or 'Words'.  If there is a string that you want to find or compare then this is where you should put it.  You can place up to three strings here - the exact number will depend on the specific question that you are asking.
5. The  'Logic Operators'  -  AND / OR / NOT :

These are intimately related to the strings mentioned above.  They determine exactly how the strings will be used in the search.

Some examples are given here, but the general principle should be clear after a little experimentation.  It really should be quite intuitive.

If AND is Chosen and two strings are specified, the Program will pick out only those Patient entries which match up with BOTH String1 AND String2.

IF OR is chosen and two strings are specified, the Program will pick out all the Patient entries which match up with EITHER String1 OR String2.

If NOT is chosen, then the program will pick out only those Patient entries which do NOT match up with the String in question.

Now for some examples - first you have to be sure exactly which question you are asking.  I will now go through a few questions and show how these questions translate into the text which you enter into the dialogue box.

QUESTION 1:  Which of my patients have had complications?

I have already stated that if one of my patients has a complication, then I specifically identify that patient by the text "Comp - ", followed by the complication itself.  I normally enter this in the 'Notes' field, but really the search would work which ever field it was in.  If the complication was a DVT then I would enter it in the record as "Comp - DVT".

To list all the patients with complications, enter "Comp - " as String 1, and 'AND' as the logic operator.  Finally, press <Enter>, and the program will print out that list.

QUESTION 2:  Which of my patients have had Complications which were Chest Infections?

Here we will be looking for database records which have both the strings "Comp - " and "Chest Infection".  So the way to do this is to enter "Comp - " as String 1 and "Chest Infection" as String 2.   The logic operator in this case will be 'AND'.

QUESTION 3:  Which of my patients had either a Chest Infection or a CVA?

The two stings to enter are obvious.  The logical operator is 'OR", because the program will search through the whole database file and any record which contains the EITHER the string 'Chest Infection' OR the string 'CVA' will be printed.  The record wouldn't need to contain both strings for it to be printed - just one of them would be sufficient.  (It would however still be printed if both of the strings were present).

QUESTION 4:  Which of my patients were not under the consultant 'Forster"

Enter 'Forster' as String 1 and select 'NOT' as the logical operator.  This will produced the required list.

QUESTION 5:  Which of the patients under my consultant 'Forster' had either a Chest Infection or Angina?

Enter 'Forster' as String 1, 'Chest Infection" as String 2, and 'Angina' as String 3.  The logic operator is  1 AND ( 2 OR 3 ).   Two strings must appear in each matched record.  'Forster' must always appear, but either one or the other of the other two strings can appear - it doesn't matter which.

QUESTION 6:  Which of my patients had complications, but weren't under the consultant 'Forster'?

String 1 is 'Comp - ' and String 2 is Forster.  The logic operator is  1 NOT 2.

It should rapidly be becoming obvious how this is all working.  Have a look at the sample printouts which give an example of most of the searches which are possible with this program.  Then look at the file 'Dummy', ask some questions concerning the data and then attempt to answer them using the program.  Generally have a good experiment and see what you come up with. You can't do any harm!

6. Case Sensitivity :

Whether the letters in the search are 'Capitals' or 'Miniscules' is not normally important.  But consider the situation where you want to search for all the patients who have had Myocardial Infarctions.  My code for this (quite reasonably) is 'MI'.   If I were to enter 'MI' as String 1 and then start the search without specifying the case sensitivity, then I would get many mis-matches, such as the 'mi' in 'hemiparesis'.  To ensure that these mis-matches don't occur, enter 'MI' as normal but specify the search as 'Case Sensitive' and things should go fine.
7. Finally, you can change the printer driver from Epson to Hewlett Packard or whatever, depending on what printer you have in front of you.  Most printers have output which is compatible with one of these two printers.   Canon printers will work with Epson Codes.

If you do not have a printer and you wish to transfer the formatted document printout to another computer, then you can choose the option 'Print To File'.  The file created will be called 'P.lis' and will be placed in the Psion root directory.  This file can later be transferred to a PC or Macintosh using the appropriate serial link software, and then printed from your desktop computer.

If none of the specific printer drivers seem to work, then choose the 'General Printer Driver'.  This should work with virtually every printer under the sun, because it sends only ASCII characters to the printer and no control codes.
8. When the program has finished printing, it will then helpfully display the number of patients it has printed or matched.  You can then decide whether to exit the program or do another search.


1. Whilst the program is running, pressing any key will halt the listing until you press another key.  This is useful if you want to have a look at the screen output before it scrolls away.  It also might be useful as an aide to tidy printing.  You can stop printing in the middle of a page if you want to, press 'Form Feed' on the printer, change the paper, and then press another key on the Psion to resume printing.
2. When the program is running, it will only list a single line of patient information on the screen.  It is done this way because the Psion screen is quite small and it is difficult to display large amounts of information all on the screen at once tidily.  This means that the diagnosis is often cut short on the screen, but note that whenever a printer is connected, it will always send all of the relevant details to the printer, despite what is seen on the screen.  If however you want to see all the details on the screen as the program runs, then change the printer driver to 'General' or 'To File', and what comes up on the screen is exactly what would be printed if a printer was connected.
3. To break out of the Program while it is running: Press <Psion Esc>.
4. The program will work on the Psion Siena, but it is not directly designed to do this.  The screen output will be all jumbled, but the printer output should be fine.


1. The only potential problem with this program occurs if the Psion Communications Option is set to 'Serial port'.  If you try to run the program on a Series 3c with communications on serial port, then the program will come up with the error 'File or device in use'.   This is not my error!  It stems from the fact that the Series 3c expects to get serial communications *only* when 'Serial port' is selected.  If you try to use the same serial port to print using a 'parallel' cable or even test to see if a printer is connected through a parallel cable, the computer will come up with this error.

The simple solution to this problem, is to set communications to 'Psion IR' (infra-red) or to 'None'.  This menu can be brought up in the system screen by pressing <Psion L>.  The program should then work as normal.
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. If it seems that the program is coming up with more matches than seems right from the printout, be aware that the printout contains details of everything except the ward the patient was on.  The printed page is crowded enough as it is, and with the ward present there as well, it seemed just too crowded.  In my opinion, the ward seems to be the least important audit parameter, so I left it out.  An example of this is when carrying out a search for 'mi'.  It comes up with all the patients who had 'myocardial infarctions' and hemipareses, but also some others as well, which you can't immediately see why they were matched.  These other patients were matched because they were on 'Fleming Ward'.


(Experienced Programmers Only)

1. If you wish to have the Labels in the Data File in a different order to the one I have chosen, you will need to change the order of the variables in the line which begins OPENR.  You will also have to change the two variables 'wardpos%' and 'datepos%', which indicate the respective positions of the labels of the ward and dates in the data file.
2. If you wish to add a new Printer Driver, you will need to know the various printer codes relating to underlining text, making text condensed, etc.  I suggest you replace one of the Printer Drivers already on this Program with your own codes.  printer% is the relevant variable to look for.
3. If you want to fit more or less characters on one line, then you will need to alter the Variable 'rmargin%'.  This is equal to the maximum number of characters allowed on one line.  It will be different for different printers.
4. If you want to change the Maximum Width (in characters) allowed for each column on the screen / printout, then the appropriate variables are namelen%, bedlen%, conslen%, hosplen%, doblen%, doalen% and dodlen%.  This might be necessary for example if you had a Consultant whose name was longer than 7 Characters.


1. Improve the GUI  (Graphical User Interface).
2. Activate the 'help' key within the program.
3. Write some more printer drivers for different printers.
4. Include some more advanced searching options.

Thats all.  Happy computing and happy doctoring.

(Please send all bug reports and suggestions to my email address).

©  Dr. Jason Wolfe (1993 - 2001)

PostBox   To contact me : Email  

WebPic    My Website is at   http://www.jwolfe.clara.net.  You're already there !!

Top     Back to  Top of Homepage

   Last Modified : 31st March 2001