MJDBase

By Michael Jackson

 

Issue 29

Sep/Oct 87

Next Article >>

<< Prev Article

 

 

A powerful and flexible database for your 8-bit Atari

Michael Jackson provides what many serious Atari owners have longed for

MJDBASE is a fully featured database for your 8 bit Atari. You can use it for keeping details of your record collection, books, addresses, reference articles or for Club records and sports records. In fact, anything you need to keep a record of can be included because you can configure MJDBASE to suit yourself.

TYPING IT IN

MJDBASE is a complex piece of software and the Listings are, naturally, quite long but if you use TYPO 3 as you go, you shouldn't have any problems. There are three listings in all which should be typed and SAVEd in order. You must use the filenames "D:INTRO" for Listing 1, "D:MJDBASE2.MGR" for Listing 2 and "D:MJDBASE2,UTL" for Listing 3. To run the program you type RUN "D:INTRO" which will then run the other modules. You can, if you wish, add an autorun for the INTRO program.

USING MJDBASE

MJDBASE is divided into two modules. The main 'Manager' module allows you to add, delete, search, sort, update, mark, extract or list records whilst the Utilities module is for setting up, re-organising and generally making amendments to the structure of the database. The full instructions for each module follow and it is essential that you read through the appropriate sections as you use the program. You will need to keep the instructions handy as you use MJDBASE so it may be a good idea to photocopy the pages and keep them with your disk. The program is relatively easy to use but it is suggested that you set up a few practice databases and try all of the features before you commit your lifetimes work of priceless information to disk!

Here are the full instructions for using MJDBASE.

THE MANAGER MODULE

MJDBASE is the main record management module of the MJDBASE system. This module allows you to :

1. Open Database 6. Close Database
2. Obtain Record 7. MJDBASE Utilities
3. Add Record 8. Directory of Databases
4. Sort Records 9. Bulk Output
5. Review Structure 10. Drive Set Up

This section will take you through each of these functions and show you what they do and how to use them to best effect.

1. OPEN DATABASE

This command allows you to connect to a given database and must be used before any operations can be performed upon a database.

On choosing the command, there will be a prompt for the Database name. If the user has forgotten what databases are available on the disk, then by entering 'L' and pressing RETURN, a list of databases will be given. (This can also be achieved from the main menu option (8)- Directory of Databases.)

Once a database name is supplied (a database of this name must have been previously created by using the 'Create Database' command found in MJDBASE Utilities module), your MJDBASE Manager will connect with the chosen database and load information about the database in question and will show :

1. How many fields.
2. Field Details.
3. How many current records.
4. Maximum No. allowed.
5. The Key Field.
6. Direction of Key.

(If there are no records in the database you are reminded at this stage that you need to use the option Add Records).

This is known as the 'Structure' of the database and the MJDBASE Manager must know all these details in order to manage your data correctly.

Having successfully opened your database, you are returned to the main menu. You will notice that the name of the currently connected or opened database will now appear toward the top of the main menu screen. You are now ready to use the other commands. If you attempt to use other commands (except 7 & 8) before opening a database, you will be reminded that you must 'Open the Database first'.

2. OBTAIN RECORD

The Command to obtain a record allows you to access any or all of the records in your database. Once you have obtained your record, several other commands will become available to you. These will be explained a little further on.

On choosing this command, you will be prompted to indicate a number indicating one of the following search criteria by which your record or records will be obtained or retrieved:

1. KeySearch 3. Marked Records
2. Flip 4. Any Character

Key Search: This search criteria gives you the fastest retrieval time since it references your index which is held in memory. When you enter this choice, you will be prompted for a value which MJDBASE Manager will use to locate your chosen record or records. If, for example, you entered 'HELLO', it will search those records whose key field contains the characters 'HELLO' as the starting characters. (If your index length is say, 3 characters, MJDBASE Manager will choose those records with 'HEL' as being the first characters in the key field. Index information will be found in the chapter describing the MJDBASE Utilities module)

The smaller the search data you supply, the wider the potential range of 'matched records'. N.B. Please note that this key search assumes that your search characters start with the first character of the key field.

Flip: Should you wish to browse or 'flip' through the records without actually searching for any particular one, this command will obtain all the records for you in the logical sequence dictated by the sorted order of your index (i.e either in ascending alphabetic or descending alphabetic order)

Marked Records: This search option will only access those records that have been 'marked' (for details about 'marked' records please read about the 'Mark Record' sub-command further on.)

Any Character: This is a flexible search option since it allows you to search your whole database for a string of characters. Since this option scans the whole database without the key, this takes a little while depending on the size of your database. Please be patient!

Having displayed your record on the screen you will notice that the key field will be indicated by an ' > ' to the left of the field name.

You will also see an information bar across the top of the screen. From left to right you will see 'K'; 'Rec No' and 'Search'. Next to 'K' you will see either 'a' or 'd' showing that the key is in Ascending or Descending order and beside that you will see for how many characters. The 'Rec No' sign indicates the logical number of the record in key order. The 'Search' indicator shows the criteria by which you are currently obtaining records.

As mentioned earlier, once a record has been obtained and displayed on your screen, you have several sub-commands available that mainly relate to the currently displayed record:

a) Next record f) Reshow Record
b) Back to the last record g) Stop obtaining
c) Erase record h) Mark record
d) Update record i) Clear mark
e) Print obtained record  

Let's look at each of these sub-commands:

Next record: You will see from the highlighted sub-command bar that to obtain the next record, you merely press RETURN. This will obtain the next record that conforms to the currently sorted alphabetic order and/or search criteria.

Back to last record: By entering 'B', MJDBASE Manager will re-obtain the last record that was displayed. This is particularly useful if you wish to redisplay a previous record without having to go through the main menu again.(This option is currently only available with the 'Flip' search criteria.)

Erase record: This command will remove the currently obtained record from your database. (See how to revive these records in the chapter dealing with MJDBASE Utilities). By using this command, two things happen:-

1. All reference to the record will be removed from the index that is held in memory.

2. The record on your database will be 'flagged' as having been deleted. (The physical record will still remain on your database but will not be recognised by MJDBASE Manager)

As you use your database, you will find that the database data file will become increasingly populated with 'deleted' records. (This will be indicated by having a large data file when you are only dealing with relatively few records). From time to time, it will be necessary to 'weed' them out totally. The 'Compact Database' command will do this for you. This is found on the menu to the MJDBASE Utilities module. For further details see 'Compact Database' in the chapter dealing with the utilities. WARNING: The 'compact database' utility physically removes the flagged records. Make sure that you have 'revived' all the records (this option is found in the Utilities module) you want before you use this command. There is no return after this!

Update record: By entering 'U', MJDBASE Manager will ask you which field of the obtained record you wish to update. Enter the number which relates to the field you wish to update. (When a record is displayed on the screen, each field will have a number beside it on the left. This is the number you enter)

On entering the the number, the appropriate field will be displayed together with it's current contents. The cursor will be automatically positioned at the beginning for your convenience. Make your amendment to the field as you wish then press RETURN. (Remember not to amend the field to a size larger than is allowed for it.)

The record will be re-displayed showing you the latest change. You will be prompted for another field number to update. When you have finished updating a record, enter 0 to the prompt. The database file and index will be amended accordingly and the next record will be automatically obtained for you. (You will not be allowed to update a field with more characters than the field was originally meant to hold. This is defined when you create your database. See the chapter on Utilities for more information.)

Print Obtained Record: This sub-command ('P') will allow you to obtain a 'hard copy' of the record you have currently obtained on the screen. Be sure that your printer is turned on and 'on line' to your computer.

Reshow Record: This command allows you to redisplay a record which has too many fields to show on the screen at one time. This saves you from having to advance to the next record then use the 'B' command to get back.

Stop obtaining: Entering 'S' will stop further searching on the database and return you to the main menu.

Mark Record: There may well be times when you want to remember a particular record or records for your own special reasons, perhaps as reminders of some sort.

MJDBASE will allow you to flag or 'Mark' any record with this command. As a result, every time a marked record is obtained you will be reminded by a beep sound. Marked records can also be searched for under the 'Obtain Record' command called from the main menu.

Clear Mark: This command will remove the 'mark' from the record.

3. ADD RECORD

This command allows you to expand your database with more records. When you enter the command, you will be prompted for data for each field within the record. When you are entering a key field you will be notified of this by a > ' to the left of the field name.

After all the fields for each record have been entered, you will be prompted to indicate whether further records are to be added. If so, then merely press RETURN, if not then press 'E' to end. As you enter the records they will be automatically sorted in accordance with the existing index.

4. SORT RECORDS

This command allows you to sort the active (in memory) index in the opposite alphabetic order that is currently in force. This means that if you want to change the direction by which you obtain records then you don't have to re-create the index!

On entering this command, you will be reminded what the current index direction is and prompted to enter 'A' for Ascending or 'D' for Descending. On entering 'A' or 'D' your index will be sorted instantaneously and you will be returned to the main menu. You will now be able to obtain your records in accordance with the new key direction.

5. REVIEW STRUCTURE

This option allows you to review the status of the currently opened database at any given time. As mentioned before, this is automatically given to you when a database is initially opened. It is useful, though, to be able to remind oneself what the current index is and the field lengths.

6. CLOSE DATABASE

This is the command to signal to MJDBASE Manager that you have now finished with the database. It is important to use this command if you have made a change to the database since you opened it. If this is neglected, then you will lose the current index and possibly lose track of all the recently added records.

In order to remind you when it is important to close the database when you have finished with it, the option on the main menu will be highlighted.

N.B. If by accident, you do forget to close the database or there is a power failure before you can close it, then all is not lost! Please see the section of DATABASE RECOVERY later on.

7. MJDBASE - UTILITIES

This option allows access to the second of the MJDBASE modules. The utilities. Details about this module will be found later in the article.

8. DIRECTORY OF DATABASES

This command allows you to see what databases are on a disk.

9. BULK OUTPUT

Up to now, your MJDBASE Manager has allowed you to view and print your records on an individual basis as you have obtained them. This useful command allows you to output your selected records in different formats either to screen, printer or disk on an automatic basis (without having to press RETURN for next record etc.)

On entering this command, you will be prompted for the search criteria as usual (See Obtain record). Here you will be saying to MJDBASE Manager that all the records that you want output via the Bulk Output routine will conform to this search key data.

Once you have entered this, you will be asked whether the Bulk Output is to be directed to the screen,printer or in extract mode. By entering 'S' or 'P' output will be listed to the screen or printer respectively. The data output will comprise of your selected fields side by side under the headings. For example:

NAME ADDRESS
Fred Bloggs 10, Downing Street
Ivy Tilsley 7, Newhaven Road
Jack Waddle "The Oaks", Country Lane

The 'Extract' mode is a more flexible mode and is primarily designed to allow 2 styles of output:

1. Data output will consist of field data only (no headings) and each selected field will output one after the other rather than being output side by side or on one line as just described previously (see above example). This means that simple labelling output can be achieved.

2. Data can optionally be output in Database format thus giving you the ability to create new database data files. If you choose to only output some fields, you can effectively 'delete' a field when creating your new database file. If 'Extract' mode is chosen, you will be prompted with 'Enter Device'. Please enter 'S:'(for screen output),'P:'(for printer output) or 'Dn:xxxxxxxx.xxx'(for disk output).

Using 'extract' for Database creation

If you opt for disk output with the aim of creating a new database, please do the following:

1. Make sure that the output filename you supply has an extender of '.DAT' since this signifies a data file to MJDBASE

2. Answer to the question about database format.

3. After the data has been output to the disk file. You must use the 'Create Database' command in the Utilities module to create the structure which will reflect the fields which are in your newly created database file. Make sure you call the database the same name as the database data file you have just created (excluding the extender).

4. Use the 'Create Index' in the Utilities module to register your new database file into an index.

Finally, you are able to direct MJDBASE which fields you want included in the output. Not all of the fields need be output. The number relating to a field that is to be output should be entered. This must be repeated for as many fields as are required. These numbers are found to the left of the field names.

In addition to the actual field numbers, there are 3 extra values which can be used:

a) 0 This means you have finished your selection of fields for output.

b) -1 This means you want all the fields in the record output. (This is easier than entering all the field numbers one at a time!)

c) 99 This clears all the fields you have selected in case you change your mind and want to start again.

When you enter 0, MJDBASE will do the work!

10. DRIVE SET UP

This command allows you to use more than one drive and so eliminate disk swapping. The MJDBASE software will always expect to find its component modules in Drive 1. Therefore, the Master disk holding the MJDBASE modules must always be inserted in Drive 1 when prompted.

11. DATABASE RECOVERY

Should your computer system crash or be switched off before you properly close the database, you will lose your active index to that database.

When this happens, it means that you may not have an up-to-date index by which you can keep track of your records. You are able to recreate your index by using the 'Create Index' command found on your MJDBASE Utilities module. For more details on this, see the documentation dealing with the Utilities module.

MJDBASE - UTILITIES

MJDBASE Utilities is a database tool module and is part of the overall management of your database. This module allows you to :

1. Create Index 6. Delete clear database
2. Compact Database 7. Drive set up
3. Create Database 8. Restructure database
4. MJDBASE Manager 9. Revive records
5. Directory of databases  

This section will take you through each of these functions and show you what they do and how to use them.

1. CREATE INDEX

This utility causes MJDBASE Manager to arrange and sort your records on any field.

MJDBASE Manager will only be able to look, retrieve and organise records that appear in an index. If, for example, your current index is based on the key field 'NAME' and the index is in 'Ascending' order, then all records will be presented to you so that the field NAME will be in alphabetic order.

An index also allows MJDBASE to locate your chosen record much faster by simply searching the index rather than the complete data file.

On entering this command, you will be reminded of the structure of the database in question and prompted for the field number which you want as the key field. Once you enter the number, you must then enter the number of characters of the key field that you want to be included in the index. The larger the number of characters, the more precise the search and sorting operations will be but also you will be able to manage less records. You will be given a guide as to the maximum number of records you can safely expect to enter with any given index size. This will be notified to you on the 'Review Structure' and 'Open Database' commands on MJDBASE MANAGER module as well as with this command.

Once you have entered the field number you want as the key field, you will be asked whether you want the index sorted in Ascending alphabetic (A Z) order or descending (Z A). Enter A or D as appropriate.

The Create Index utility will now create your new index for you.

2. RECOVERY WITH CREATE INDEX

This command does not look for an existing index and therefore can be used to create an index which has been lost or corrupted by accident.

3. COMPACT DATABASE

After a while, you may find that your data file is extremely large considering it's holding relatively few records!

This is because when you delete records, they are not physically removed from the data file but merely flagged as having been deleted. It is done this way for the sake of speed and convenience when using your database. As a result, you should strip away the deleted records occasionally until your data file only holds 'live' records thus giving you more space on your disk.

This utility does just this job. It strips away and thereby compacts your database file. Not only does it do this but it automatically re-indexes the new compacted file in accordance with the existing index.

Once you enter this command, you will be prompted to enter the name of the database which you want compacted. Once you have done this, it will display the structure for your information. Follow the prompts and your database will he compacted.

4. CREATE DATABASE

This is the command to use when you want to set up a database right from the beginning.

You will be prompted for a name that you want to know the database by. Enter any name. (Not longer than 8 characters) Next you will be asked how many fields your records will have. Please indicate this.

Now you will be prompted for details about each field a) the name and b) its length. The name of the field must not exceed 12 characters. You will next be reminded of all the fields that you have defined (and their lengths) and asked to designate one of the fields to be the key field by entering the appropriate number. You must next define the number of characters of the chosen key field to which the key will apply.

The utility will now create your database. If you later wish to change the index length of the key field, you can use the 'Re-Index' utility.)

Your database is now ready to have records added to it via MJDBASE Manager module.

5. MJDBASE MANAGER

This command accesses the main record management module, MJDBASE Manager.

6. DIRECTORY OF DATABASES

This command allows you to see all the databases on your disk.

7. CLEAR/DELETE DATABASES

This command is one to use with care! Clearing a database is not the same as deleting it.

When you clear a database, you merely remove all the records from it and the database will be almost as if you just created it except that it will still retain the current index structure.

Deleting a database physically removes all trace of a database from your disk!

You will be warned just before the deed is done in case you want to change your mind! Just follow the prompts but be careful!

8. DRIVE SET UP

This command allows you to use more than one drive and so eliminate disk swapping.

The MJDBASE software will always expect to find its component modules in Drive 1. Therefore, the Master disk holding the MJDBASE modules must always be inserted in Drive 1 when prompted.

9. RE-STRUCTURE DATABASE

This command allows you to alter the size of existing fields within your database.

Even if the database has hundreds of records already in it, this command will allow you to shorten and lengthen fields to accommodate your new requirements.

On entering this command, you will be prompted for the database name which you want to restructure. On entering the name, the Utilities module will load the current description or structure for your information and then display the fields for amendment.

You will be asked to enter the number of the field you wish to alter and then be prompted for its new size. The fields will be redisplayed reflecting the new size for your chosen field. This operation can be repeated until you have decided upon the new field sizes that you want. When you have finished, you must enter 0 to indicate this.

The MJDBASE Utilities will recreate your database records with the new sizes incorporated. If the new size is smaller than the original, your data will be truncated so beware!. If your new size is longer than the original, then your field will be padded out with spaces.

10. REVIVE RECORDS

This command is probably the most precious one you will want if you erase records by accident. Those records erased SINCE the last compaction can be resurrected with this command.

On entering this command, MJDBASE will prompt for the database name. Once you have entered this, MJDBASE Utilities will scan your database for erased records and present them on the screen individually for you option to revive or not.

If you choose not to revive any displayed record, you will still have the chance to revive it until you COMPACT the database. Then all 'erased' records really will be beyond reach!

Listing 1 - Loader

AtariLister - requires Java

Listing 2 - Manager Module

AtariLister - requires Java

Listing 3 - Utilities

AtariLister - requires Java

  top