- - - * * * R A M B A S E * * * - - -
- - - * * * VERSION 2 * * * - - -
--------------------------------------------------------
Written in 1990 by John Fairlie - Tel 0225-873988
20 Montague Road, Saltford, BRISTOL, Avon. BS18 3LA
--------------------------------------------------------
This 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. You
will need to have BANKMAN.BIN on the same disc for the program to work.
RAMBASE contains all the program code and will load BANKMAN if it is not
already loaded.
The program is written entirely in BASIC and uses standard 'Bank Manager'
commands for reading and writing records to the second 64k, ie, ùBANKOPEN,
ùBANKWRITE, ùBANKREAD, and ùBANKFIND. The program can therefore be easily
followed and understood by anyone conversant with BASIC and these commands.
$
Copyright Notice
----------------
Although this program has been placed in the Public Domain, I retain all
copyrights to this program, and persuant to this, this program MAY NOT BE SOLD
BY ANY PARTY unless specifically authorised by the author, John Fairlie, in
writing, prior to the first copy being sold. As well, this program MAY NOT BE
INCLUDED IN ANY OTHER PACKAGE FOR SALE, even if this program is indicated as
being 'in the Public Domain.'
All of the above applies to both the original as well as any derived, or
modified copies of the original. Any modified copies of this program MUST NOT
have the copyright notice violated, changed, or otherwise altered.
Please report any copyright violations to the author, at the telephone number
above. Thank-You.
$
Program Concept - The 64k Forerunner
------------------------------------
RAMBASE was designed to be compatible with a smaller program called
DATABASE.BAS which stores all data in the first 64k along with the program.
This was limited to data files of some 12k in size and an overall maximum of
200 records. Small records could utilise the full 200 capacity, but larger
records would be limited in number by the memory space available. RAMBASE
overcomes these problems. RAMBASE2 is a development of RAMBASE, with
additional facilities.
The datafiles created by any of these three programs are interchangeable in so
much as file format is concerned, but obviously, if a RAMBASE file is created
with more than 200 records, or more than 12k in size, then it will be too
large to be loaded by DATABASE. RAMBASE files will have a suffix of .DBF so
DATABASE files must be saved with this extention to permit loading by RAMBASE.
If you have a 6128 then use RAMBASE, it is quicker for searching, even when
there are far more records, and has far more record holding capacity and far
more powerful facilities. RAMBASE files can contain up to 64k of data in
theory, but this would be if all fields were full of data.
$
Program Concept - Continued
---------------------------
RAMBASE1 was basically a RAM version of DATABASE but with extra user
friendliness, and many of the options were 'beefed up' (without using up space
for record data!) It comprised 24k of BASIC as opposed to DATABASE's 15k.
RAMBASE2 has many more facilities - it is the final version which occupies 34k
of BASIC.
Introduction
------------
The notes in this file do 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 hassle.
$
Files
----- RAMBASE2 consists of the following files:-
RAMBASE2.BAS 34k The Basic Program
RAMBASE .DOC 22k This information file
RAMSCRN .BIN 17k The Introductory Screen
BANKMAN .BIN 2k Needed to install Bank Manager Commands
Just RUN "RAMBASE2, the introductory screen will be shown, followed by the
Main Menu. The Status Line will remain at all times while RAMBASE is running.
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, 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 therefore variable and can be calculated
as:-
INT ( 65536/(no of fields * field length))
The following table gives an indication of the maximum number of records
possible:-
$
--------------------------------------------------------------
NUMBER OF ------------- FIELD LENGTH ------------
FIELDS 10 20 25 30 40 50 60
--------------------------------------------------------------
1 6553 3276 2621 2184 1638 1310 1092
2 3276 1638 1310 1092 819 655 546
3 2184 1092 873 728 546 436 364
4 1638 819 655 546 409 327 273
5 1310 655 524 436 327 262 218
6 1092 546 436 364 273 218 182
7 936 468 374 312 234 187 156
8 819 409 327 273 204 163 136
9 728 364 291 242 182 145 121
10 655 327 262 218 163 131 109
11 595 297 238 198 148 119 99
12 546 273 218 182 136 109 91
13 504 252 201 168 126 100 84
14 468 234 187 156 117 93 78
15 436 218 174 145 109 87 72
16 409 204 163 136 102 81 68
--------------------------------------------------------------
$
Altering / Deleting Records
---------------------------
Here you can select the field you want to edit with the cursor keys, and press
C, indicating that you wish to Change the contents.
You can also go straight to the next or previous record with cursor right or
left keys. So amending a number of closely grouped records (as is often the
case), is easier. To delete a block of records, use option Q.
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 preceeded by *. (Which must use a slower method.) In either case, all
fields are searched for the input string. In simple search the find will be
'case specific', but for Wildcard search, upper or lower case finds will be
returned.
$
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. To Merge Load a file, use option P.
$
Sorting
-------
Sorting is a most powerful feature on 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.
$
Output Options
--------------
It is only when you come to the output options that you realise that this is
not just a database, but a complete data management system. The power and
flexibility of the program 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 printer, the screen will prompt for a
number of copies. This allows generation of numerous copies of the same
label.
$
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 dBase dosen'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 ù 0666-507547 ù 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.
$
Disc Utilities
--------------
This option has been added because I was saving files - only for the save to
abort half way through due to lack of disc space. So without having to exit
the program, you can catalogue the disc and see how much free space is
available. The program will also give an estimate for the disc space needed
for the current file. This will depend on the extent of data in each field,
but should be no more than 1k out.
If in-sufficient space exists, you can erase all .BAK files, or any other file
you name.
Catalogue .DBF files may be useful prior to a load operation, so you can see
which databases are on the current disc.
$
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.
$
Merge File
----------
This option allows you two combine two databases into one. Before merging
takes place, the file structures are compared and shown to advise you if they
are compatible, and to confirm that 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.
$
Delete Records
--------------
Option C can be used to delete individual records, one at a time, but this
would be tedious if you wanted to delete a considerable number. Option Q 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.
Delete a Field
--------------
Have you ever wondered how frustrating it would be to have up to 1000 records
loaded up, in three fields, only to find that due to changing requirements,
you only really need two 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.
$
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, along with how many records you would need to delete to
be able to add a field. You could also reduce the field length if you didn't
want to delete records.
$
Change Field Length
-------------------
This allows you to increase or decrease the field length even when records
exist. 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 <Enter> when requested for the new
field length. (Or enter the existing value).
$
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 which codes are sent automatically, and also gives details of
some others which may be useful. Any valid series of codes may be sent from
this option.
$
Change Default Disc Drive (With Patch R2D2.BAS Only)
-------------------------
This amendment is contained in a BASIC file only 1k in size. First LOAD
"RAMBASE2.BAS, then MERGE "R2D2.BAS. The amended lines in R2D2.BAS will
overwrite lines in RAMBASE2 and hence incorporate all the amendments required
for operation with 2 drives. To permanently patch your copy of RAMBASE2, you
will then need to SAVE "RAMBASE2.BAS.
Rambase will then support more than one disc drive with a new option V on the
Main Menu. The default drive is set as shown in the Status Bar. Pressing V
will toggle between drive A and B.
System files, ie, the Screen file RAMSCRN.BIN and the option H information
file (this file) will ALWAYS be expected to be found on drive A. Other files,
ie, 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 preceeded by A: or B: as required, as part of the filename.
$
A Heading for Tables (Version 2.1 Only)
--------------------
Version 2.1 allows a table heading to be added to tables sent to the printer
with Option L. The heading will be in double width, and will be no wider than
the table.
$
File Amended Warning
--------------------
RAMBASE2 checks whether your file has been amended and not saved, whenever you
might lose your changes, ie, on Program Exit, Create New File, or Load File.
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 200. Do NOT enter RUN if you
wish to retain data.
$
Version 2 Enhancements (Other than new menu options N to U)
----------------------
1. A bug on Tabulate when the width of the table was 80 has been cured.
2. Free Bytes in the Status Bar are now more stable and reliable.
3. A audible beep has been added to the Sort and Save Options.
4. The Memory Buffer (for Reading & Writing to disc) is now permanent.
5. A bug on Tabulate to a Discfile is cured (Position of name on screen)
6. Amend Record - the cursor stays at the field last amended when you move to
the next or previous record.
7. The Sort routine can now sort Ascending or Descending.
8. The Menu Displays which options can be used prior to a file existing.
9. On Tabulate Print, the printer will not skip perforations, if DIP switches
are set to do so.
10. A Introductory Title Screen is provided.
11. The Option H method of screen or printer selection has been improved.
12. Speed Save has been removed as redundant. Compact save has been speeded
up and is now the standard save method.
13. Label Print can now print many copies of one label.
14. Searching can now be by true Wildcards.
$
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 1991 would be
91-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
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
>RU 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>