EUG PD
1st April 2000Categories: Description: Utility
Author: Gus Donnachaidh
Published in EUG #50
I found a program in a book called Practical Programs For The Electron by Owen Bishop and Audrey Bishop, published by Granada Publishing in 1984 for a simple database program. It was called Info File. If you have a copy, you might want to compare the original with my version.
I liked it because of an interesting search facility which will quickly search for single letter strings as well as multiple letter strings. I have named it PROCsearch. It is used in conjunction with PROCdisplay. It might be useful in another program.
I didn't like it because of the primative program structure. Lots of GOTOs, hardly any use of PROCedures and some superfluous bits.
I have made a number of major and minor changes to this program to make it work the way I wanted it to. Anyone else who thinks the same way as I do might like to try other adaptations. Extending the number of records should be fairly straightforward; simply a matter of identifying the relevant DIM statements. I think one or two which remain may be redundant.
I did consider leaving in the original lines, hiding them with REM statements. However this took up a lot of memory and in any case most of these were pointless.
The original program included a portion to create a data file which was then loaded when the program was re-run. This was because the program was originally written to use with tape. I started by removing this create routine and making it a separate program called Create. As it only needs to be used occasionally, it was just wasting space and speed.
I removed most of the GOTOs, replacing these with logical jumps. I had to leave two in PROCinput; one was the loop controling this PROC and I didn't see any real need to change it. The other controls the delete function. More about this in a moment. There are numerous other line jumps, of the variety, IF ... THEN 550. I removed a number of these but many remain.
I added a GOTO to PROCdisplay to allow for a printout of a record to be made.
I re-organised the various menus and submenus and made the input routine work a little easier.
I have kept the line numbers, as far as possible, the same as the original.
The DELETE key will place a | (pipe) character on the screen. This indicates that all the text in this field has been deleted. You can either re-type it or use the cursor and COPY keys to copy what you want. I tried removing this line, 1200, so that the DELETE key worked as normal in the input routine and the program seemed to work fairly well. However, the deleted characters were still in the saved data file. There were also a few other unpredictable results, mainly concerned with the amount of characters available in the field.
Each field can have a maximum of 80 characters, two lines of text in Mode 6. There can be up to 4 fields.
I have added a facility to put carriage returns into a field so that an address will look ok. To use it, you type *. The * won't appear on the screen, instead a carriage return will be effected.
I have created an address book with two fields per record having an 80 character capacity. One field could be used for an address, while the other could be used for any comments which might be relevant.
If you create another data file using Create, remember not to save it with the name ADDRESS or ADD.
To run another file, load Add and LIST 340. Change the name ADDRESS to the name of your file.
I have identified many of the variables. Unfortunately, between doing most of this work and writing this info file, I have lost the bit of paper on which I wrote them down. Ahhh!
The ones I remember are these:
N$ | - | Name of data file |
A$ | - | Input variable |
L | - | Record number |
J | - | Field number |
N-1 | - | Field number |
N$(J) | - | Name of field |
LEN(E$) | - | Total number of characters entered in a field. |
NC(J) | - | Number of characters allocated to a field. |
This program may be useful to store small amounts of information, then have a search facility available to look for it. It may also be used as a template to develop something which may be more specialised and potentially useful.
Gus Donnachaidh, EUG #50