- - - * * * R A M B A S E VERSION 5.1 July 1996 * * * - - -
The origin of Version 1 is lost in the mists of time, but Version 2 was written
in 1991 by John Fairlie and adapted from a program in the Public Domain called
"DataFile" written by an anonymous author for the CPC 464, which was very
bugged, and we have John's valiant effort to thank for converting this into
something remotely useful, and for bringing the 2nd Bank of RAM into use.
To save a boring history of previous versions, suffice to say that I (Barrie
Snell) have transformed the version given away with the cover-tape from AMSTRAD
ACTION almost beyond recognition, with a greatly expanded Main-Menu, faster
Sorting for large data-bases, easier Editing, faster Browsing, better Error-
trapping, (Plus other options that you will see for yourself.)
John is now out of touch with this latest version, so if you have any requests
for extra routines, or modifications to existing routines, write to me at:-
Barrie Snell, 8 St. Augustine Rd, Southsea, PORTSMOUTH, Hants, PO4 9AD.
John has a PC (Proper Computer) if you are interested, and is very good at
QBASIC and its other PC variants. He has produced a fundamental version of
RAMBASE for a PC and can be contacted by telephoning 0 1 2 2 5 8 7 3 9 8 8.
$
Introduction
~~~~~~~~~~~~
RAMBASE is a database that uses the extra 64k of memory for the storage of
data. Therefore, it will only work on a 6128 or 464/664 with expanded memory.
It contains all the program code and will load BANKMAN if it is not already
loaded. (If you have an expanded 464 or 664, do NOT use the bank switching
software as well as BANKMAN. Use one or the other.)
The program is written entirely in BASIC and uses standard 'Bank Manager'
commands for reading and writing records to the second 64k, e.g, ùBANKOPEN,
ùBANKWRITE, ùBANKREAD, etc.. The program can therefore be easily followed and
understood by anyone conversant with BASIC and these commands.
This file does NOT comprise instructions for running RAMBASE. You should find
all necessary instructions on-screen as you go along, generally on the bottom
line of the screen. These notes are merely to amplify the operation of RAMBASE
so you get the maximum benefit from the program, with the minimum of hard work.
$
Files
~~~~~
This disc containing RAMBASE Version 5.1 consists of the following files:-
RB .BAS The Basic Loader. ( RUN "RB" to set everything going )
RBCODE .BAS The Main Program Code.
RB .BIN Needed to install Bank Manager Commands (2nd bank of RAM)
RB .DOC This Information File in Ascii.
SAMPLE .DBF An example to experiment with to find your way around all the
options. It consists of FIELD 1 American States, FIELD 2 the
Year they joined the Union, and FIELD 3 the Capital City of the
State. Feel free to play with it. That's what it is for.
RB .XRF An Ascii file of Cross-references of Variables and Line-numbers
of RB.BAS to enable you to amend it for yourself.
RBCODE .XRF An Ascii file of Cross-references of Variables and Line-numbers
of RBCODE.BAS to enable you to amend it for yourself.
READER .BAS An Ascii-file reader if you haven't a word-processor package.
$
Status Line
~~~~~~~~~~~
The Status line displays the number of loaded records, the maximum number of
records possible of the defined size, the percentage of record holding capacity
currently used, the number of the current record being processed or displayed,
the default disc drive, and the default filename. It also includes the revision
number of RAMBASE, and the menu option currently selected.
Designing a Database
~~~~~~~~~~~~~~~~~~~~
When deciding the number of fields and maximum field length, you may be free to
pick the ideal characteristics for your application. But if you think that even
RAMBASE may be hard pressed to store all your records, then you may want to
consider limiting the number of fields, or shortening the maximum field length
to get more record holding capacity. It is then desirable to make use of the
maximum amount of space in each database record possibly by having a greater
number of shorter fields, than fewer long ones. If the long ones had a
disproportionate amount of unused space in some of the fields, then this limits
the maximum number of records. The maximum number of records is variable and
can be calculated as:-
INT ( 65536/(no of fields * field length))
$
The following table gives an indication of the maximum records possible:-
No.OF ù ---> FIELD LENGTH <---
FIELDSù 10 20 30 60
----------------------------------
1 ù 6550 3270 2180 1090
2 ù 3270 1630 1090 540
3 ù 2180 1090 720 360
4 ù 1630 810 540 270
13 ù 500 250 160 80
14 ù 460 230 150 70
15 ù 430 210 140 70
16 ù 400 200 130 60
Alter / Delete Record(s)
~~~~~~~~~~~~~~~~~~~~~~~~
This option can be used to delete individual records, one at a time, but this
would be tedious if you wanted to delete a considerable number. Another option
is therefore provided to delete all records in a continuous block. Use this
option with care, deleted records cannot be resurrected unless they had
previously been saved to disc.
$
Exchange Blocks of Records
~~~~~~~~~~~~~~~~~~~~~~~~~~
Say you had the following:-
RECORD CONTENTS RECORD CONTENTS
1 aa and you want to rearrange 1 aa
2 bb it to get the order on 2 ee
3 cc the right. -----------> 3 ff
4 dd 4 gg
5 ee 5 dd
6 ff 6 bb
7 gg 7 cc
8 hh 8 hh
In other words, exchange record blocks 2 to 3 with 5 to 7. You could do this
with the Save File option to first save record 1 to disc, say with the filename
1.DBF, then records 2 to 3 to disc with name 2.DBF, then record 4 under 3.DBF,
then records 5 to 7 under 4.DBF then lastly record 8 under the filename 5.DBF .
Then you would use the Load File option, to load in the file 1.DBF and then
continually use the Merge File option to first merge the file 4.DBF, then merge
in the file 3.DBF, then 2.DBF and finally merge 5.DBF . Of course, you then
have to use the Disc Utilities option to erase the 5 unwanted files from disc!!
This option takes out all the hard work, and leaves the disc clean as well!
$
Insert a Record
~~~~~~~~~~~~~~~
Another very valuable extra feature. You will have noticed that the Sorting of
a quite large database was very slow. Say that you already have a large
database and you want to add just 3 records to it (your latest acquisitions for
your stamp collection, say).
Previous versions forced you to add these at the very end of the whole file,
then you had to wait around for hours if you wanted it sorted. This version
lets you Browse, and then you can find the rightful sorted place for the new
record and place it there, without having to do any Sorting at all!
Even doing this 3 times, as in the above case is very swift and hassle-free!
$
Sorting
~~~~~~~
Sorting is one of the most powerful features of RAMBASE. You can sort the file
on any field, and records may be partially sorted; it is not necessary to sort
the whole file. If you need to have all the records for "SMITH" in order of
say, Age, then sort on Surname to get all the Smiths together in a group, then
sort just the Smith group on the Age field. You could then go further and sort
the 25 year old Smiths on Town; the possibilities are endless.
The file will be permanently sorted. If you then save the file, it will be in
the same sorted order when you next load it.
Sorting will be necessary when you come to examine the output options. You will
then be able to output just the data you want, how you want, and in the ORDER
that you want.
$
Tabulate Records
~~~~~~~~~~~~~~~~
This will produce a compact table where the width of each column is variable
and automatically adjusts to the maximum length of the data it has to hold.
(Even dBaseIII Plus doesn't do this!!). So you don't need to calculate the
width of each column, RAMBASE does it for you! Just say what records you want,
and then what columns, and again, columns can be in any order, and a field can
be repeated in a table if required. A sample output is given here:-
---------------------------------------------
ù INDEX ù TELEPHONE ù XMASLIST ù <--- Field Names
---------------------------------------------
ù Anne & John ù 01666-50754 ù Y ù ç
ù Carol & John ù 92-5234 ù Y ù 3 Records
ù Chris M & Family ù 83017 ù Y ù /
---------------------------------------------
See - Variable column widths, even caters for a heading being wider than the
data! Record Numbers can also be included if required.
$
Summate Records
~~~~~~~~~~~~~~~
If your records contain numeric data, then this option can be used to get an
on-screen total of a continuous series of records. The numeric data can have
any number of spaces to the left of the number, and anything to the right of
the number, including text. For example, a database of discfiles may have a
field for size of file and contain entries such as 12k, or 23k etc. This will
be correctly totalled, but fields such as.. 'Owes 3.52', or 'Credit 4.69' will
count as zero as there is text to the left of the number. Enter these fields as
3.52, or -4.69 and all will be well.
However, there are one or two cases where an error could result. They are where
a string starts with a plus sign, minus sign, or decimal point, AND have text
after them with no numbers, e.g.:-
+ + + Testing, or
- - - Testing, or
. . . Testing
All this was pointed out by Barrie in Version 2 and was incorporated by John
into Versions 3 and later.
$
Saving / Loading of Data
~~~~~~~~~~~~~~~~~~~~~~~~
Files can be Saved in whole or in part. You can therefore create sub-files of
continuous blocks of records. This can be created with the Sort option to get
all records of a like kind in a block, then saving just that block of records.
Files with a suffix .DBF can be Loaded and will replace any file currently in
RAM. All data is saved in a single file.
Searching
~~~~~~~~~
Searching is of two types. Simple search which uses ùBANKFIND and can employ ?
as a wildcard character, and true Wildcard searches that have the search string
preceded by *. In either case, all fields are searched for the input string. In
a simple search the find will be 'case specific', but for Wildcard search,
upper or lower case finds will be returned.
$
Merge File
~~~~~~~~~~
This option allows you to combine two databases into one. Before merging takes
place, the file structures are compared and shown to advise you if they are
compatible, and confirm there is enough free space to load the extra records.
Field names do not have to be the same, the original field names, field length,
and file name will stay unchanged. If the merged file field length is longer,
then data will be truncated to fit. If it is shorter, then no worry either,
extra spaces will be added. If the two files have different numbers of fields
then merging would create an enormous mess and will therefore not be allowed!
If all is well, press C as instructed and the file will be merged in. If there
is only room for part of the merged file, then as many records as possible will
be merged in only.
$
Add a Field
~~~~~~~~~~~
The complement facility to the Delete Field. This will give all those growing
applications the ability to expand with another field. Of course, there must be
space in the RAM for the extra field to be added, it will be needed even though
the field will be empty at first. If there is not enough space, the program
will tell you. You could also reduce the field length if you didn't want to
delete records.
Delete a Field
~~~~~~~~~~~~~~
Have you thought how frustrating it would be to have up to 1000 records loaded
in 3 fields, only to find that due to changing requirements you only really
need 2 fields, but have far more records to load ? Wonder no more. This
facility will quickly remove a field, along with all the data it contains,
freeing space for more records.
$
Change Field Length
~~~~~~~~~~~~~~~~~~~
This allows you to increase or decrease the field length. If you reduce it,
then obviously some data may be lost from the ends of fields. If you increase
it, then space must exist in the RAM for the extra capacity. The screen will
prompt for the range of allowable field lengths which will not be greater than
the program maximum of 62. If the RAM is nearly full, an increase of only a few
characters will be possible. To abort this option if selected in error, press 0
(zero) when requested for the new field length.
Exchange Two Fields
~~~~~~~~~~~~~~~~~~~
An extra feature by Barrie. Sometimes I find that I want to alter the structure
of the database; e.g. the PHONE number field might want to be at the top of the
screen instead of at the bottom. Of course, you are not restricted to just
exchanging the positions of 2 fields. If you want to swap 3 fields around then
you plan ahead and then swap 2 fields twice!
$
Convert to Upper Case
~~~~~~~~~~~~~~~~~~~~~
Added in version 5. There is a school of thought that says all text input to a
database should be in upper-case so as to make searching easier for somebody
else to use it. You can convert the whole file (i.e. all fields of all records)
or just one field of all the records. This option is NOT re-convertible back to
lower-case, so use with extreme caution.
Output Options
~~~~~~~~~~~~~~
When you come to the output options you realise that this is not just a
database, but a complete data management system. The power and flexibility of
RAMBASE really come into their own here. Two main output options are provided.
Label Print, where data fields are output vertically in groups for each record,
and Tabulate, where fields are output horizontally with data for one record on
one line of output. In either case, output may be sent to Screen, Printer or
DiscFile. (The Tabulate Print is limited by the width of the Screen or the
width of the printer - but smaller tables can be output to any device.)
$
Label Printer
~~~~~~~~~~~~~
Address label printing is just one possibility here. Put ordinary paper in your
printer and run this option if you don't want sticky labels.
Three output sizes are catered for with the default set to 9 lines for the most
common one and a half inch label. This means the number of lines of output for
each database record. You can print just part of the file, right down to just
one record. Field names are also optional. The content of the label can be any
fields in the record, IN ANY ORDER, and can be repeated within the label if
required. You can even put text on all 9 lines of a 9 line label, leaving no
space between records, or have any number of empty lines anywhere in a label.
And output to printer can be in any of five typefaces. Sounds complicated? Not
so. All options are made from a single screen, and most selections are made
with the cursor keys.
If you are only printing one label to the printer, the screen will prompt for a
number of copies. This allows numerous copies of the same label.
Make good use of the "Set up Printer" option here, or use its front-panel
switches or DIP-switches before actually printing.
$
Disc Utilities
~~~~~~~~~~~~~~
Without having to exit the program, you can catalogue the disc and see how much
free space is available. If insufficient space exists, you can erase all .BAK
files, or any other file you name.
Catalogue .DBF files may be useful prior to a load or save operation, so you
can see which databases are on the current disc.
Set Up Printer
~~~~~~~~~~~~~~
This option allows codes, other than those sent automatically by Label or
Tabulate Print, to be sent to the printer, ie, set typefaces before printing
this information file, or set left margin before printing a table. The program
is set up with codes for EPSON compatibles, and must be changed manually if you
have a printer which requires different codes.
The screen shows codes sent automatically, and gives details of others that may
be useful. Any valid series of codes may be sent from this option.
$
Change Default Disc Drive
~~~~~~~~~~~~~~~~~~~~~~~~~
The default drive is set as shown in the Status Bar. Choosing this option will
toggle between drive A and B. You must have a disc in the required drive for
normal operation, or if you make a mistake at this stage then don't worry about
it; the computer will know which drive(s) you have got connected and take the
appropriate logical action.
Databases and output discfiles will be saved to and loaded from, the default
disc drive as set by this option.
The default disc drive can be overruled by using a six (or less) character
filename preceded by A: or B: as required, as part of the filename, but
obviously don't use B: unless you have a 'B' Drive !!
Heading for Tables
~~~~~~~~~~~~~~~~~~
This allows a heading to be added to tables sent to the printer. The heading
will be in double width, and will be no wider than the table. This was an
excellent additional innovation by John Fairlie to the original RB2.
$
File Amended Warning
~~~~~~~~~~~~~~~~~~~~
RAMBASE checks if your file has been amended and not saved, whenever you might
lose your changes, ie, on Program Exit, Create New File, or Load File, etc..
You are then given the option to return to the Main Menu. If the file has been
amended, then the warning will be activated, and will be shown by an asterisk
by the filename in the status bar. The warning is only deactivated (and the *
removed) when a full save is made, ie, all records are saved to disc.
Note:- Program Escape/Abort
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Functions which drastically change your data irrecoverably, ie, Sorting,
Deleting Records etc., come with an on-screen abort option. At other times, the
program can be aborted by pressing ESC twice. The menu can then be recovered
with all data intact, by entering GOTO 10. Do NOT enter RUN if you wish to
retain data.
$
How to Store & Sort on Dates and Numbers
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
While RAMBASE only really supports string variables, dates and numbers are
easily catered for with a bit of thought. Enter your date as YY-MM-DD and
always use two digits, ie, 01 for January. So the ninth of July 1993 would be
93-07-09. Files sorted on date would then end up in the correct order. For
numbers, always enter the decimal point at the same position in the field, ie,
xx2.0, x20.3, 130.5, xx0.5. (Where x signifies a space)
Use With Promerge
~~~~~~~~~~~~~~~~~
Database files created with RAMBASE are readable directly with Promerge. I
(John Fairlie) wanted to create a table similar to the RAMBASE Tabulate Records
option, but with a limitation, ie, to only print records until a condition was
met. I also needed text displayed both before and after the table. An example
that should set you thinking along the right lines follows. (A simpler option
is to use the label print option, but output to a discfile).
$
>ZM ; To Zero all margins
>AV "End Date ? " date ; To accept the end condition
>DF DACARDEX.DBF ; Define the File
>RV num1 ; Reads Field length, Num Records Etc.
>RV head1 head2 head3 head4 ; Reads the Field Names
-------------------------------------------------------------------------
& head1 & & head2 & & head3 & & head4 & ; Prints the Headings
-------------------------------------------------------------------------
>RP ; Starts Repeat
>RV data1 data2 data3 data4 ; Reads first Record
>IF data2 =< date ; Tests it for meeting the condition
& data1 & & data2 & & data3 & & data4 & ; Prints it if OK
>EI ; End of IF condition
>UN data2 > date ; Until - and the condition
>CF ; Closes the File
<text that is displayed after the table>
END