diskMAGazine (Apr 1992) : bBase.doc

                                 bBaseII

                                Version 5


                                    by


                              Robert Bromley


                             November 5, 1991



     If you would like to make a print-out of this documentation,
     I would recommend that you print out the file "bBaseII_printme.doc".
     It will make a neater print job.  This file is the same, except it
     has all of those messy ANSI codes removed.
     

                               TABLE OF CONTENTS


      1   INTRODUCTION     .............................................  1
          1.1   What is bBaseII?     ..................................   1
          1.2   Feature Summary      ..................................   1
          1.3   Hardware Requirements     .............................   1
          1.4   Software Requirements     .............................   1
          1.5   Restrictions     ......................................   2
          1.6   Copyright     .........................................   2
          1.7   Starting bBaseII     ..................................   2

      2   THE REQUESTERS     ..........................................   2
          2.1   The ARP File Requester     ............................   2
          2.2   The String Requester     ..............................   2
  
      3   THE CURSOR KEYS     .........................................   3
          3.1   If the String Requester is NOT Open     ...............   3
          3.2   If the String Requester IS Open     ...................   3

      4   THE SCREEN GADGETS     ......................................   3

      5   THE PROGRESS BAR     ........................................   3

      6   THE MENUS     ...............................................   4
          6.1   Project Menu     ......................................   4
             6.1.1   Create a New Database      (F1)     ..............   4
             6.1.2   Open an Existing Database  (F2)     ..............   4
             6.1.3   Display Entire Database     ......................   5
             6.1.4   Display Matching Records    ......................   5
             6.1.5   Save the Current Database  (F3)     ..............   5
             6.1.6   Save As     ......................................   5
             6.1.7   About     ........................................   5
             6.1.8   Quit  <Esc>     ..................................   5
          6.2   Sort Menu     .........................................   6
             6.2.1   Incremental Sort  (F4)     .......................   6
             6.2.2   Decremental Sort  (F5)     .......................   6
          6.3   Search Menu     .......................................   6
             6.3.1   Select Search Criteria  (F6)     .................   6
          6.4   Change Menu     .......................................   6
             6.4.1   Field Titles     .................................   6
          6.5   Print Menu     ........................................   6
             6.5.1   Displayed Record  (F8)     .......................   6
             6.5.2   All Records  (F9)     ............................   6
             6.5.3   Matching Records      ............................   6
          6.6   Add Menu      .........................................   7
             6.6.1   A Record  (F10)     ..............................   7
          6.7   Delete Menu     .......................................   7
             6.7.1   Displayed Record  <Del>     ......................   7

      7   OTHER FEATURES     ..........................................   7
          7.1   The "Disable Save" Option     .........................   7
          7.2   The Companion Program - bBaseII50K     ................   7
          7.3   The Low Memory Warning     ............................   8

      8   EXAMPLE DATABASE     ........................................   8

      9   CREDITS     .................................................   8

     10   REVISION HISTORY     ........................................   8



     1   INTRODUCTION

     1.1   What is bBaseII?

     bBaseII is a full-featured, intuitionized, reasonably fast and, I
     think you will agree, quite an easy-to-use database program.  What it
     does is store, sort, sift, and search for information, (but it won't
     dial your telephone).

     Once a database has been loaded from disk, all modifications are done
     in RAM:, and will NOT be permanently saved until the database is Saved
     to disk.  This can be done using the Menu, the Function Keys,
     or upon Quiting.

     All functions of bBase may be accessed from Menus.  Most also have
     keyboard equivalents for the hard-core CLIers. It multi-tasks
     extremely well, as it does not burn up CPU time while not actually
     performing operations.

     bBaseII was written in HiSoft BASIC Version 1.05, and compiled using
     the HiSoft BASIC Professional compiler.

     
     1.2   Feature Summary

     Some of the features of bBaseII are:

     - Fully intuitionized.
     - Very straightforward and easy to use.
     - Uses a fast (for a BASIC program) shell-sort algorithm.
     - Incremental or decremental sort, on any field.
     - Search in any (or all) field(s).
     - Optionally display entire database, or a filtered list, a screenful
       at a time.
     - Print out a record, a filtered list, or the whole database.
     - Optionally disable the "Save to Disk" option to prevent accidental
       alteration of the database.
     - Well-behaved in a multi-tasking environment.

     
     1.3   Hardware Requirements

     Database programs tend to gobble up large amounts of memory.  bBaseII
     is no exception.  Since bBaseII opens on it's own screen, and reserves
     memory to hold a database in RAM:, it requires about 375K of memory to
     run properly with a FULL 600 record database.  This could be reduced
     if the maximum number of records was reduced, but it was necessary to
     hard-code in something, so that's what I picked.

     I would not recommend running bBase on a basic 512 Kb machine.

     
     1.4   Software Requirements

     The "arp.library" will have to be in your libs: directory, because
     bBase uses the ARP file requester - but everyone should have that
     there by now, right?


     1.5   Restrictions

     - 9 fields per record.
     - bBaseII: 600 records, or a database of approximately 100K,
       whichever comes first.
     - bBaseII50K: (Refer to Section 7.2 - "The Companion Program"): 600
       records, or a database of approximately 50K, whichever comes first.
          
          NOTE 
          Be careful when the database size exceeds 100K (or 50K for
          bBaseII50K) - it will exit ungraciously if it runs out of memory.
          This is the main reason I limited the maximum number of records.
          Refer to Section 7.3 - "The Low Memory Warning".

     
     1.6   Copyright

     bBaseII is Copyright (1991) by Robert Bromley.
     All rights are retained by the author.

     Use of this program is at your own risk and discretion.

     This program is freeware, and may be distributed free of charge.
     Nominal charges for copy media only, are permitted.

     
     1.7   Starting bBaseII

     From the Workbench; just click on the icon.

     From the CLI; usage is:      Run bBaseII [-s] [-fFilename]

     Including the -s switch will start bBase with Saves Disabled.

     Including the -f switch will automatically load the requested database
     file.  Naturally, you need to specify the full path, but leave off the
     ".bbase" extension.   IE. :

                      Run bBaseII -s -fDF0:Files/Recipes 

          
          NOTE 
          When using the -f switch, no spaces are allowed in
          the filename path.



     2   THE REQUESTERS 
     
     2.1   The ARP File Requester

     The requester used when asking for a file to Load or Save is the
     standard ARP file requester.

     
     2.2   The String Requester

     This requester is used for general input.  It has full editing
     capabilities.  It may be blanked at any time by pressing <Alt-X>.
     Any time this requester is open, pressing <Esc> will close it.



     3   THE CURSOR KEYS 
     
     3.1   If the String Requester is NOT Open:

     Pressing the Cursor Up key will take you directly to the First Record.
     The Cursor Down key displays the Last filled Record.
     The Cursor Left key shows the Previous numerical Record, and
     the Cursor Right key will show the Next numerical Record.  
 
     You can also move through the records using the mouse (Refer to
     Section 4 - "THE SCREEN GADGETS").  The VERY last record is always
     blank, which is where additional records may be entered.  This blank
     record is accessed through the "Add" Menu item, or by pressing F10.

     
     3.2   If the String Requester IS Open:

     Whenever you are in Edit Mode (ie. the string requester is open, so
     that you may Enter or Change data), Cursor Left/Right moves the cursor
     within the gadget, while Cursor Up/Down moves through the fields.



     4   THE SCREEN GADGETS 

     The Information Box at the bottom of the screen contains a      /\
     gadget that looks something like that shown at the right.       ||
     This gadget represents the Cursor Keys, and you can move     <== G ==>
     about the database using these gadgets and the mouse            ||
     instead of the Cursor Keys, if you so desire.                   \/ 

     Clicking on the Up Arrow will take you directly to the First Record.
     Clicking on the Down Arrow will take you to the Last filled Record.
     The Left Arrow will show the Previous numerical Record to the one
     currently displayed, and the Right Arrow will show the Next Record.
     If the Last Record is currently displayed, this will take you to the
     blank record, where a new record may be entered, although this is more
     easily accomplished by using the "Add" Menu item, or by pressing F10.

     Clicking on the "G" in the center of the arrows will bring up the
     string requester, asking for the number of a record to "Goto".
     After entering a legal number, the requested record will be displayed.



     5   The PROGRESS BAR 

     When time consuming actions are being performed, ie. Loading,
     Searching, Saving, Sorting, etc., a "progress" bar will appear to
     assure you that "something is happening", and visually display
     to you just how the job is progressing.



     6   THE MENUS 

     bBase operation is best described by the operation of the Menus.
     The keyboard equivalents, where applicable, are shown along with the
     Menu Titles.

     
     6.1   Project Menu
     
     6.1.1   Create a New Database  (F1) 

     This will bring up the ARP file requester, asking for a name for your
     new database.  Any filename of 20 characters or less will do.
     The requester will then ask how many fields the new database will
     require.  bBase will accept up to 9 fields in each database.

     You are then asked for the TITLES of each field of the database.
     Each field title may be a maximum of 19 characters long.  A "(1)" will
     appear, along with the string requester.  Enter the title of your
     first field, ie. Last Name, First Name, Company, Address, or anything
     else.  When it is correct, hit <Return>, and a "(2)" will appear on
     the next line with the requester.  Enter the title of the second
     field.  Enter all the field titles in this manner.

     The screen will now show all the field titles, an Instruction Box, the
     File Name as first entered, a blank data area, and the Record Number,
     which at this point will be "1".

     The data requester will now appear in the first field of the first
     record, ready for you to enter data.  Enter the data.
          
          NOTE 
          Double quotes may not be used in any data field, as that will
          mess up the alignment of all the following fields.
          Single quotes are OK.

     A data entry may be a maximum of 46 characters long.  When it is
     correct, hit <Return> again, and the requester will move to the second
     field.  When all fields are complete, the Record Number will indicate
     "2", and the data area will go blank, (because there is not yet a
     Record Number 2).  Hitting <Return> again will start the process of
     entering data into the second record.  Complete all records in this
     manner.  In this version there is a limitation of 600 records.

     If you had been working on an existing database, and it had been
     altered, you would have been asked if you wanted to Save it before
     creating a new one.
     
     6.1.2   Open an Existing Database  (F2) 

     If you have previously created a database, and the
     "Database_name.bbase" file is stored on a disk, then use this item to
     access that database.  If you are working on an existing database, and
     it has been altered, you will be asked if you want to Save it before
     loading another.  Enter the path to the database file in the requester,
     and that database will be retrieved and shown on screen.  Only files
     having the extension ".bbase" will be accepted.  Use the Cursor keys
     or mouse to move about the database.  Refer to Section 3 - "THE CURSOR
     KEYS", and Section 4 - "THE SCREEN GADGETS".

     While a record is displayed, the Information Box will instruct you to
     press "<Return> to Change Data".  Do so, and the requester will appear
     in the first field, with that field's data. <Return> or Cursor Up/Down
     to the field you want to change, and make the changes.  At this point,
     you may either <Return> through all fields, or press F10 to exit the
     Editing Mode.  The altered record will be displayed.
          
          NOTE 
          ANY time you are in Edit Mode, whether Entering, Changing or
          Searching for data, pressing F10 will exit the Edit Mode, and use
          the data shown when you exited.
     
     6.1.3   Display Entire Database 

     If you want to quickly glance at more than one record at a time,
     this will open a full-sized screen, and display the first 70 or so
     characters of ALL records, one record to a line.

     The display will pause after each 23 records - click on "Next Page" or
     press any key to see the next screenful, or click on "Prev Page" to
     see the preceding page.  Click on "Cancel", or Press <Esc> to leave
     this function.  If you see a record you want to examine in detail,
     just click on it.  You will then exit the Display window, and return
     to the Main Screen, with the requested record displayed.
     
     6.1.4   Display Matching Records 

     This works the same as the previous item, except that ONLY those
     records that match the most recent Search pattern are displayed.  
     (Refer to Section 6.3 - "Search Menu").
     
     6.1.5   Save the Current Database  (F3) 

     If the database has been altered since last saved, it will be Saved
     to disk under the current filename, after confirmation.  The file
     will have the extension ".bbase" automatically appended.

     If it has NOT been altered, you will be so informed, and given
     the oportunity to abort the Save.
     
     6.1.6   Save As 

     You will be prompted for a name to Save the database.
          
          NOTE 
          Do NOT include the ".bbase" extension at this time.
          It will be appended automatically.
     
     6.1.7   About 

     The usual stuff.
     
     6.1.8   Quit  <Esc> 

     If the database has been altered, you will be asked if you want to
     Save it before Quiting.

     
     6.2   Sort Menu

     You may sort the records in the database based on the data in any
     field.  The Sort routine is very efficient for a BASIC program.
     
     It will sort 200 records in less than 10 seconds on a standard A2000.
     As the database size increases, naturally it tends to slow down.
     
     6.2.1   Incremental Sort  (F4) 

     The requester will ask which field you want to sort on.  The records
     will be incrementally sorted on that field, and Record Number 1 of
     the new list will be shown.
     
     6.2.2   Decremental Sort  (F5) 

     Same as above, but records are sorted and displayed from z-A, or 9-0.

     
     6.3   Search Menu
     
     6.3.1   Select Search Criteria  (F6) 

     The requester will appear in the first field of a blank record.  
     <Return> or Cursor Up/Down down to the field that contains the data
     you want to search for.  Enter the search string in that field.
     A search string may be entered in more than one field.  When all the
     criteria has been entered, <Return> through all the fields, or press
     F10.  All records that match ALL the search criteria will be
     displayed, one by one.  When a record is found, you may Print it, 
     Cancel the search, Continue searching, or Review all the records that
     match that Search pattern.  (Refer to Section 6.1.4 - "Display 
     Matching Records").  Search is NOT case dependent.

     
     6.4   Change Menu
     
     6.4.1   Field Titles 

     Use this item to change the Template, ie. the Titles of your fields.
     The NUMBER of fields may not be changed.  The data itself is
     unaffected by this procedure.

     
     6.5   Print Menu
     
     6.5.1   Displayed Record  (F8) 

     This item will send the displayed record to the PRT: device.
     
     6.5.2   All Records  (F9) 

     This item will send the entire database to the PRT: device.
     
     6.5.3   Matching Records 

     Sends all records that match the most recent Search pattern to the
     PRT: device.


     6.6   Add Menu
     
     6.6.1   A Record  (F10) 

     Positions you at the last (empty) record, with the input requester
     open, ready for you to enter data into the first field.  Use the
     <Esc> key to back out if you arrived here by mistake.

     
     6.7   Delete Menu
     
     6.7.1   Displayed Record  <Del> 

     After confirmation, the record currently displayed is Deleted.



     7   OTHER FEATURES 
     
     7.1   The "Disable Save" Option

     As a simple security device, mainly as a guard against someone
     accidentally altering or erasing data, I have added an option which
     will disable the ability to save database changes to disk.  

     To disable Saves, simply press "Alt - S" simultaneously.  The titlebar
     will briefly inform you that Saves are disabled, and now any attempt
     to Save the database to disk will be circumvented.  In this case, upon
     Quiting, a requester will ask if you want to Save the database
     (as usual).  If you select "Save", a second requester will inform you
     that the Save option has been disabled.  To Save the database, at the
     next requester, "Do you Really want to Quit?", select "Cancel",
     re-enable Saves, and Quit again.

     If you are running bBase from the CLI, using the "-s" flag on the
     command line will start bBase with the Saves already disabled.

     The "Alt - S" combination will toggle between Save Enabled and Save
     Disabled.  The titlebar message will keep you informed of the current
     status as it changes.

     
     7.2   The Companion Program - bBaseII50K

     I am including in this package a companion program (bBaseII50K) for
     those users who are having memory problems while running bBaseII.
     bBaseII50K is identical to bBaseII except that it reserves about 100K
     less memory for operation, and has a database limit of about 50K.

     If anyone should need a database of more than 600 records, and have
     the memory to support it, no problem - just let me know!


     7.3   The Low Memory Warning

     When bBaseII is run, it reserves about 200K of memory, (bBaseII50K is
     less) to use for database storage in RAM, arrays, etc.  No matter how
     much RAM your computer has, this is all that is available to bBase!
     When a database is first loaded (and only then), bBase will check
     the available memory left in the program pool.  If the memory
     available to bBase is less than 2K, this means that you have a
     humungous database of over 100K, and only another 5-10 records may be
     added before the program will crash.  In this case, you will be
     advised of the situation.  Press any key to cancel the warning.
     The recommended action is: 

        1.  If you are using bBaseII50K, start using bBaseII.
        2.  If you are using bBaseII, delete some old records.
        3.  Give me a call.  We can get you a larger version.
        4.  Upgrade from bBase to dBase.
          
          NOTE 
          If you are loading a new database after having just finished
          work on another, it is possible get get a false warning here.
          If you know your database size is within limits,
          I think you can safely disregard this warning.



     8   EXAMPLE DATABASE 

     There is an example database included in this package.  Everyone uses
     the Name and Address example, so I opted for something different.
     The file "Recipes.bbase" is a sample database showing one way of
     keeping track of recipes, without having to re-type them all.
     It merely shows where they can be found when needed.  With this
     database you can Sort the recipes by Name, Catagory, or anything else.
     You can Search for all recipes containing a listed ingredient, recipes
     you have already served to given people, or just the location of the
     recipe if you have forgotten which of your 647 recipe books it is in.
     I have found this to be very useful.



     9   CREDITS 

     My thanks to Peter Keegan, of Harvard, Massachusetts, and to Bobby
     Foreman, of West Sacramento, California, for taking the time to write
     in and point out some of the deficiencies of Version 1.



     10   REVISION HISTORY 

     Version 1:     First release - May 1991

     Version 2:     Internal

          - Added F10 shortcut to quit editing.
          - Added <Esc> to return directly to program.
          - May now cursor up/down through fields while editing.
          - Added the ability to specify a database on the command line.
          - Added <Esc> to Quit via keyboard.
          - Added the "Add a Record" menu item.
          - Bug fixes.

     Version 3:     Internal,  September 1991

          - Added the "Display Entire Database" and "Display Matching
            Records" menu items.
          - Add "Print Matching Records" menu item.
          - Changing the maximum number of records was causing crashes.
            Hard-coded maximum at 600 records, and alloted memory
            accordingly.
          - Added the -s and -f command line options.
          - Changed colors to make the screen more readable.
          - Added the Progress Bar.
          - Changed the sort algorithm from Bubble to Shell.  Much faster.
          - More bug fixes.

     Version 4:     Internal,  October 1991

          - Can now go directly to a record from the "Display Entire
            Database" and "Display Matching Records" windows, by clicking
            on it.
          - Field Titles now stay neater after being changed.

     Version 5:     Released November 1991

          - The Sort algorithm is now case independent.
          - Added the Low Memory Warning.
          - Bad bug: If the database was sorted decrementally, on a field
            which was blank in some records, and a record was deleted,
            one record's data would become corrupted.  Now fixed.
          - When Displaying Entire Database, or Matching Records, you can
            now back up, and display the Previous Page.
          - Still more bug fixes.



     It's taking me a long time to find all these bugs by myself, and I
     know it's still not perfect.  If anyone out there is using this
     thing, I would appreciate some constructive criticism.

     Name and address in "About".

     Email (until April 1992): CRS; Conference 5, 
     or Usenet; Bob.Bromley@canrem.uucp

     Hope someone finds this useful.

     Bob