First Base (shareware version 1.80) - Database 1. First Base .................................... 3 1.1 Introduction ................................ 3 1.2 Applications ................................ 3 1.3 Size restrictions ........................... 3 2. Required files ................................ 3 2.1 Database file description ................... 3 2.2 Definition file description ................. 3 2.3 Report format file description .............. 4 3. Definitions ................................... 4 3.1 Fields ...................................... 4 3.2 Records ..................................... 4 4. Running First Base ............................ 4 4.1 Starting .................................... 4 4.2 New File Creation ........................... 4 4.3 Making The Definition File ...................4 4.3.1 Completing Definition File Entries .......5 4.3.2 Use of Alternate Definition File .........5 4.4 Data Entry .................................. 5 4.4.1 Procedure ............................... 5 4.4.2 Editing Keys ............................ 5 4.4.3 Function Keys ........................... 6 4.5 Sorting ..................................... 6 4.5.1 Single field ............................ 6 4.5.2 Double field ........................... 6 4.6 Searches .................................... 7 4.7 Field Limits ................................ 7 4.7.1 Limits Description ...................... 7 4.7.2 How to Set Limits ....................... 7 4.7.3 Setting field number .................... 7 4.7.4 AND and ORs in Limits ....................8 4.7.5 Entering Upper and Lower Limits ..........8 4.7.6 How Limits Work ..........................8 4.7.7 Canceling Limits ........................ 8 4.7.6 Printing Using Limits ................... 8 4.8 Averages and Totals ......................... 9 4.8.1 How to Enter and Use .................... 9 4.9 Deleting Records ............................ 9 4.9.1 Deleting With First Base ................ 9 4.9.2 Deleting With An Editor ................. 9 - 1 - 5.0 Data Output ................................... 9 5.1 Output To A File ............................10 5.1.1 Making Subset Of Data Base ..............10 5.1.2 Adding Or Deleting Fields ...............10 5.2 Output To A Printer .........................10 5.2.1 Print Sizes .............................10 5.2.2 Multiple Records Horizontally ...........11 5.3 Report Format ...............................11 5.3.1 Creating Format With External Editor ....11 5.3.2 Page Layout .............................11 5.3.3 Report Format Description ...............11 5.3.4 Creating Format With First Base Editor ..12 5.4 Page adjustments ............................13 5.4.1 Page Format .............................13 5.4.2 Start Output ............................13 6.0 Sample database ...............................13 6.1 Loading sample database .....................13 7.0 Suggestions welcome ...........................13 - 2 - 1.0 First Base description 1.1 First Base is a fast memory resident database system for small and medium size applications. It is not full featured but has a wide range of uses, is fast and very easy to learn and use. It runs in medium or high resolution on an any Atari computer in the ST line. 1.1.1 Options in the program are selected either by use of the function keys or by selecting from pull down menus with the mouse. The return, delete, backspace, insert, home and arrow keys are also used when editing a record. 1.2 The program has a wide range of applications. Examples include address lists, video tape listings, computer program lists, records of checks, christmas card lists, library loan, video tape rentals and many more. 1.3 The entire database is loaded into the memory of your ST. The more free memory you have the larger the database possible. Assuming you have sufficient memory up to 20000 records may be created. Each record may consists of up to 1000 characters that in turn may comprise up to 11 fields. 2.0 Necessary files 2.1 A First Base database consists of three basic files. The first of these contains the data for all records. It is named whatever file name you decide with the extender .DAT. It is organized as one record per line. Each line may be up to 1000 characters long. The data is in ASCII format with no control or special characters so the file will appear normal when viewed and it will be accessible to editors or other programs. 2.2 The second file is the definition file. The name is the same as the one chosen above with a .DEF extender. This file defines the field names and the length of each field. It is also in normal ASCII format. It can be created with the First Base program or it can be made with an editor or word processor that does not put formatting characters in its data file. - 3 - 2.3 The third file specifies how the data is to be printed and the heading to be used on the page. The name is made up of the same file name above with the extender .RPT and is referred to as the report format file. Like the files above it is in normal ASCII format and may be accessed or created by other programs or editors. The file consists in line one of a heading plus 11 lines of format some of which may be empty. 3.0 Definitions 3.1 A field is defined to be a piece of information. For example a persons name, a disk number, a date, etc. It will be displayed on one line on the monitor screen. 3.2 A record is defined to be from 1 to 11 fields that are related. For instance a persons name, their street number, their city and state, their birth date. 4.0 Running the program. 4.1 To run the program double click on FB.PRG, Then click on select. When the file selector box is shown you may change disks in your drive or select another drive. To select another drive change the drive letter in the file selector box and click the mouse on the bar above the file names, then select the correct folder. Finally use your mouse or type in the name of an old .DAT file. 4.2 If you choose to make a new file, type the new file name in the selector box. It must end in .DAT in order for First Base to recognize it. Following your entry press return. Brief instructions are displayed and the cursor will be positioned at the upper left corner of the screen. 4.3 You will make the definition file. First you type in the name of the first field, it looks best on the screen if it is preceded by a blank space. After the name type a : followed by a space. Finally use the _ (underscore) to specify the number of spaces desired for the field. For example... PROGRAM NAME: ____________________________ - 4 - 4.3.1 When you are satisfied with that field, press the return key. Continue in the same manner for other fields. You are limited to 11 fields and not more than 74 characters across the screen on any one field. Finally after the last field press the F5 key (write.) This saves your field definition file and you are ready for entering new data. 4.3.2 You may choose a definition file other than the default by selecting this option when prompted by the alert box. This will enable you to set up the fields in an alternate configuration. The .DEF file would have to be created on an external editor and the total length of all fields would have to match that of the data file. 4.4 Data entry. 4.4.1 To begin entering new data into the fields you must first press the F6 key. This sets up the data entry mode. After pressing F6 you fill in the fields. Field editing is outlined below. After you have finished entering data in all the desired fields press the F5 key to save the record. After pressing F5 the record will advance and fields will be blank again waiting for the next entry. When you have completed entering data for other records you can press F3 or one of the other function keys other than F5 or F6 to terminate data entry mode. 4.4.2 To edit fields the editing keys work as follows: Up arrow moves to preceding field (up). Down arrow moves to following field (down). Right arrow advances cursor to right, at end of field goes to field below. Left arrow moves cursor to left and stops at first of field. Return is similar to down arrow. Backspace deletes character under the cursor and moves it left. Insert toggles the insert mode on or off. A red I in the upper right corner indicates insert mode. Insert mode on enables characters to be inserted in a line. With insert mode off characters are overwritten. Shift home clears the fields. The do not stay cleared unless you follow by pressing the F5 key. Undo quits without saving the file back to the disk. Help displays a brief summary of commands. ----> Changes you make when editing fields are not saved unless you press F5 following them. - 5 - 4.4.3 Function keys are as follows: (F11 to F20 are obtained using shift) F1 Display next record in sequence F2 Display previous record in sequence F3 Display first record in memory. F4 Display last record in memory. F5 Write current record on screen to memory. F6 Begin entry of new record (use only once before entering records.) F7 Clear fields (but don't save to memory unless followed by F5.) F8 Sort the field that cursor is currently in. F9 Search the fields for a string. F10 Save the data in memory back to disk. F11 Delete a file from the disk (making room for .DAT file. F12 Format a new disk (currently single density 10 sector only) F13 Merge another database file with the one in memory. This will only work when both files use the save .DEF type, that is the fields are all the same type and length. F14 Quit, same as Undo. F15 Not used F16 Start output. F18 Select File output. F19 Select Printer output. F21 Select normal sized print. F22 Select condensed print (set up for Epson printer code.) F23 Toggle page format. F25-F30 Select to print number of records horizontally F32 Enter report format. F34 Enter display limits for fields. F35 Erase all limits for all fields. (F21 to F32 are not keyboard selectable in this version. You must select them from the menus using the mouse.) 4.5 Sorting 4.5.1 Ascii sorting can be made on any field, either ascending or descending. To sort first move the cursor to the field to be sorted. Press the F8 key. Use the mouse to select to sort up or down, then wait. Sorting is usually fairly fast but the following conditions increase the sorting time, a large number of records (in the thousands), more than half the available free RAM memory of your computer used by data, a lot of sameness in the field being sorted. 4.5.2 To do a double sort, first sort on one field, then resort on another field. The first field sorted will be ordered in the second field where quantities in the second field are the same. - 6 - 4.6 Searches 4.6.1 String searches can be made on any single or multiple fields. The default field is the field that the cursor is currently in. 4.6.2 To sort press F9 or select SEARCH in the pull down menu. Type in a string to be searched for. The * serves as a wild card in the string. The numbers and letters below the search string show fields that will be searched for the string. Use the mouse to click on or off any fields that you want to search. You can search forward or backward from the current record. The default is forward so if return is pressed the field is searched from the current record to the end of the data. You can also search forward by clicking on FORWARD with the mouse or you can search backward by clicking on BACK with the mouse. 4.6.3 When a match is found the record will be displayed. You may then press return to continue searching, or click on EXIT if you are done. When the first or last record is reached it is displayed showing that no further matches were found. Searches are not case sensitive. 4.7 Field Limits. 4.7.1 Lower and upper limits may be set for any of the fields for either display, printing, searching or for writing to a file. The limits are case sensitive (use only upper case if your data is in upper case) and are evaluated as ASCII starting with the first field character on the left. You can use combinations of ORs and ANDs for letting limits in multiple fields. 4.7.2 To make limits use the Set Limits option in the Fields menu. This box allows you 8 different limiting ranges that may apply to any of the 11 different fields (if you have made that many.) 4.7.3 The numbers on the left hand side in the box show the number of the field to which the limits apply and correspond to the numbers that should show at the first of each field. The limit box numbers can be changed by clicking on them with the mouse and then using the keyboard to make a change. Numbers go from 1 through 9 and are followed by A and B for 10 and 11. If an illegal entry is made it will revert to the former entry after the box is closed. - 7 - 4.7.4 The ANDs and ORs on each line are selectable and their use depends on how you want limits to be set. When no ANDs or ORs are selected for a defined field all entries will be matched for reads, searches, and outputs. If ANDS or ORS are selected and no limits are entered then no entries will be matched for reads, searches and outputs. So if you turn on all the ANDS and get out of the limit box without setting anything else you will be limited to displaying zero records. 4.7.5 The upper and lower limits are entered by clicking the mouse on the entry line and then typing them in using the keyboard. You MUST make entries starting on the first line and if multiple entries are made they must be made on the lines below in sequence. Escape erases an entry already on the line. As an entry example, if a field contains numbers and you want to show only those more than a certain value, say 1000, (they must be left justified in the field else you have have to allow for blanks before the number) just type in 1000 for the lower limit. Then when you press F1 to show the next record only those records with the value in the field that are 1000 or more will be shown. 4.7.5.1 The numerical value of the ASCII entries of the lower limit must be less than those of the upper limit. If an entry error of this kind is made the limits will revert to their previous values after the limit box is closed. You can set more than one set of limits for the same field by making several numbers at the left of the limit box the same as the field number. 4.7.6 After you have made the settings in the limit box click on OK or press return. Records display is then controlled by your settings. With only 1 AND set records with values for the set field that fall within the limit range will be used. With 2 ANDs set records must fall within the first range and the second range to be used. These ranges can apply to the same field but if they are not over lapping no data will be used. With only 1 OR set the action is similar to only 1 AND. With 2 ORs set records will be used if they either fall within the limits of the first OR or within the limits of the second OR. And more may also be used and they can apply to combinations of multiple or the same fields. When several ANDs are mixed with ORs the ANDs have priority in evaluation. 4.7.7 To cancel all limits select Erase Limits in the Fields pull down menu. This will remove all previous settings. - 8 - 4.7.8 The limits specifications do not apply to sorting. But since they do work with printing you can print out ranges of values from your database. For instance if you had a database of music files and one of the fields was the file extender you could print out a list of all music files of this type, say for example .SNG, by entering .SNG for lower limits and .SNG again for upper limits. Then only those records with .SNG would be printed. 4.8 Averages and Totals. 4.8.1 Fields with numeric values can be averaged or totaled by selecting "Totals" in the Fields menu. The totaling process will occur starting with the current record to the end of the file, so if you want to total all records you must use F3 to start at the first of the file. 4.8.2 When totaling, the limits you may have set using the limit box will be observed so this makes it possible to screen out values that are associated with fields that you may not want counted. For example if you were using one field for check amount and another field for the date you could get check totals between two dates (providing you stored the check date in most signifcant to least significant numeric format.) 4.9 Deleting records. 4.9.1 In order to delete records from a file you must first display the record to be deleted, then press F7 followed by F5. This leaves a blank record in memory. Before quitting and saving the file to disk, sort on any field in ascending order. This puts the blank records at the first of the file. When the file is saved these blank records will be skipped and not saved to disk. 4.9.2 If you have very many records to delete this can be a time consuming process. You may find it easier to use another line editor or word processor to eliminate unwanted records. These will be shown as single lines. If you do this and resave the file remember not to resave the file in word processing mode. 5.0 Data Output. You have the option of directing output copy to your printer or to a file. - 9 - 5.1 Select File Output from the Output menu to make new file copy. The format of this file is controlled by the report format file (.RPT) in a similar way that printed on a printer. Multiple records can be selected as for printing but the condensed printing option in the output menu has no effect. Reasons for making a file copy include saving for later output to a printer, making a subset of your data base, or altering your database to expand or delete fields. 5.1.1 To make a subset of your database you can set limits to screen out ranges of values in certain fields. Next, deselect Page Form in the Output menu. This will ensure that the file is continuous with no heading, and no page breaks. Next you will need a report format that exactly matches the size of fields in your current data file. This can be made as explained below. Load this format from the disk before you start. Finally use Start Output from the menu. This brings up a selector box that allows you to choose the name of your new data file. After it is entered data will be written to the disk. Next you must exit the program, and the restart it to load the file you have created. Choose the .DEF file that goes with the original data file. 5.1.2 To make a new data base with changes in size or number of fields you first need to make a report format that defines exactly how large each is and what is to be included and in what order. For instance you can increase the size of field 2 by putting in more 2s than the current field length in the report format, or you could make room for a new field by doing the same thing but specifying them on a different line in the new definition file. Or you could eliminate a field by not including it in the report format. Be sure you only use one line per record. After the report format is made proceed as in section 5.2. You will have to keep careful track of the field sizes when making a new definition file. The easiest way is to edit the old definition file with an external editor. 5.2 Output to a printer. Printer output is also selected from the Output menu. Printer output normally used page format which is selectable from the menu. However you also have the option to turn this off which eliminates page breaks and page headings. 5.2.1 Two print types are supported using Epson printer codes. These are normal, 80 characters per line maximum, and condensed, 132 characters per line maximum. These are selected by the mouse in the print menu. - 10 - 5.2.2 A number of records can be selected, from one to six, in the print menu. This number refers to the number of different records that will be printed horizontally across the page. Parts of the records may be truncated, if necessary, to fit in the space specified. 5.3 Report format. This is a file that must be created before you can start printing. It contains information that controls how the data is printed. This format file is read, if it exists when the program first starts. A different format file can be read or created by selecting Report Format in the print menu. 5.3.1 The report format file can be created through the First Base program or though a word processor or editor, for example as in the program Flash. When a separate editor is used the same rules as explained in section 3.3.2 must be followed. 5.3.2 An explanation composition of the report format file follows. The structure is different than in versions prior to 1.6. From one to eleven lines may be printed per record. Each page may include an optional title line which labels the columns that are printed. Text may be included with the file data as it is printed. The minimum number of print positions per field when printed is two. 5.3.3 The fields of a record are numbered 1 through 9 followed by A for field 10 and B for field 11. You specify where you want data of a field to be printed by using these numbers. These are differentiated from other text data that may contain these by beginning the field that contains them by a \. An example of a format line with heading line is as follows: Address Automobile Date Name \1111111111111111111111111 \5555555555 \333333 \444444444444444 - 11 - The \ is only a flag to show that a new field type is to be printed and itself is skipped when printing starts. If you want to be sure that the header columns line up with the data insert \ in the same locations in the heading line. They will also be skipped when printing. In the above example 25 places would be allotted for data from field 1 followed by 3 blank spaces followed by 10 places for data from field 5 followed by two blank spaces followed by 6 places for data from field 3 followed by two blank spaces followed by 15 places for data from field 4. If the field data is more than the places you have allowed for it will be truncated. If the places you have specified are more than the field data extra blank spaces will be inserted at the end. An example of a format with embedded text follows: Name \11111111111111111111111 Age \22 Salary $\333333 The report format file must always consist of 12 lines. The first line in the file is the heading line. If no heading is desired this line consists only of a return. If headings are used they will be aligned over the proper matching fields in the lines below. The eleven lines that follow the heading specify the format for up to 11 lines printed vertically for each record. Each line may appear as in the two above examples. If a blank line is desired you must insert only one space followed by a return on that line. The first line that contains only a return terminates the lines that are to be printed. So for instance if you wanted only one line per record (as was the case in previous versions of this program) first type the heading line, second type the format line, and on the third line only return. The other 9 lines should be entered as only a return as well. 5.3.4 When using the First Base format generator instead of an editor there are a few other features. You enter this part of the program by selecting New under Report Format. Then you enter the format for line one. When that is satisfactory you enter the column headings (if desired) which is easier to do after you have already set the number of places for each field. After that you can enter more lines of format if desired. The field names corresponding to the numbers will be shown at the bottom of the screen. When you type a \ followed by a field number the correct number of positions will be printed. If you want fewer places use the backspace key to remove them, if you want more just type them in. The line will scroll to the left if you pass 80 characters making it possible to create longer lines when using condensed printing. Only the back space key works for editing. Press return at the end of each format line. - 12 - 5.4 When data is printed using more than one line per record the number of records per page is adjusted such that a record is not broken on a page boundary. This makes printing address labels and the like possible. 5.4.1 Before you begin printing you may decide to print the data in several columns. This will condense the output and is useful when you have a large number of records and the amount of data to be printed is small. For instance if you made a list of programs and on which disk each is, you might be able to print 4 across the page compressed. Select the number of print columns from the pull down menu. After selecting Normal or Compressed is selected in the pull down menu then select Start printing. Press the escape key to abort printing has started. 6.0 Included with this program in the .ARC file is a sample database set up for keeping track of music files that I have. It is only included as a demonstration of the First Base program. 6.1 To use this run the program. Then select SONGS.DAT as the data file using the disk you have placed it on. The SONGS.DEF file sets up the field names and lengths of the fields. A sample SONGS.RPT report file is included which is set for one line per record printing. 7.0 First Base is shareware. Contributions or suggestions regarding this program are welcome. Write... Dave Henry 1720 Wickersham Dr. Anchorage, Alaska 99507 907-563-7414 - 13 -