Chapter 01 : INTRODUCTION HISTORY of MASTERFILE MASTERFILE for the ZX Spectrum first appeared in 1982. In 1985 the program was re-designed for the Amstrad CPC464. A further revision for the CPC6128 appeared in 1986. In 1987 the program was re- designed yet again for the PCW machines, and called MASTERFILE 8000. This version was in fact the basis of MASTERFILE PLUS 3, which is therefore four generations ahead of the original Spectrum MASTERFILE. The new Spectrum +3 edition offers processing power and facilities much in advance of the 1982 design, and can even do things its big brother "8000" edition cannot do. Although the full title of the program is MASTERFILE PLUS 3, we will for the sake of brevity in the rest of this manual refer to it as MF+3. SUMMARY of FACILITIES A computer filing system must store, search, display, and print your filed information. It must also permit updates by way of insertions, erasures, and alterations. Information is divided into files, records, and fields. Like all filing programs, MF+3 also demands that your data is so organised. But unlike most other programs, MF+3 allows all your data to be of variable length. This means there is no wasted space on the disk. Thus you need only give some thought to the overall volume of data when planning a file. With MF+3, the way in which data is presented is not geared to the way in which it is stored, and you may devise several different screen views of the same file of data. The display styles can be as diverse as address labels, index cards, and summary tabulations with in-flight column totals. What is more, one may extend or modify the displays at any time. You can embellish your displays with boxes, and panels of any colour. The Spectrum screen is somewhat limited, but MF+3 treats the screen as a window onto a wider virtual screen of 96 columns - even wider than a PCW screen! This certainly allows for full-width tabular reports to be printed, and for those of you with an Epson- compatible printer a huge variety of printing styles and sizes can be summoned all under menu control. MF+3 files can be keyed or unkeyed. With keyed files, records are kept in ascending key field order. Unkeyed files allow records to be inserted at any point. But any file can be sorted into a different sequence for viewing or printing. Files can be merged or split at will, subject to the RAM disk capacity. It is possible to communicate data to other systems, for example to feed names and addresses to a mail-merge word processor. This is called EXPORT. With MF+3 one may also IMPORT data (in ASCII form) from other systems. By means of EXPORT and re-IMPORT, it is a simple matter to generate one file from another file using a different data field as its key. In like manner one may convert a non-keyed file into a keyed file. Almost no matter how you design a file, it is easy to re-organise it as your needs change, without having to re-enter all the data. You can locate records in a variety of ways. You can just "browse" through the whole file, FIND a particular key or GO TO a particular record number. At a higher level of sophistication, one can SEARCH out a sub-set of the file by comparing the data with some argument. Finally, you can allocate records to any of eight SETS for later reference. The sets can be put to powerful use where composite searches are required. To change any data, all one has to do is to "steer" to it using the cursor keys and press another special key. It could not be more simple. Special facilities are provided for handling dates so that they can be keyed and displayed in "human" form, yet searched and stored in compact "machine" form. Another facility is also provided for handling names so that the title and initials are displayed the way you would want to see them on a label, yet the surname governs searching and sorting. A most powerful feature is that files may contain LOOK-UP tables which can be used to translate short codes into longer texts. MF+3 is entirely menu-driven, and there is nearly always a menu or prompt on the screen inviting your response. At such times as the program is busy doing something rather than waiting for you, it informs you. MF+3 is not only a filing and retrieval system, it can also perform calculations to derive numeric data from other fields present in a record. In a Share Portfolio for example one can after revising all the current share values multiply out each stock holding to give the current stock value. README There are bound to be changes during the life of MF+3, and perhaps corrections to this manual. All these we will have documented in a file called README, which we urge you to load (using MF+3) and examine before starting serious work with the program. GETTING STARTED Take a working copy of the MF+3 disk, by first formatting a new disk and then using +3 DOS "COPY" to transfer all components. Instructions on how to use COPY can be found in the Spectrum +3 manual. Do not un-protect your original MF+3 disk. Keep it only as an emergency back-up. To load the program, switch on your machine; insert the MF+3 program disk; press the ENTER key. After a few seconds you should be presented with the MF+3 copyright notice, version number and serial number. After a short pause this is replaced with the first menu of program options. >From menu 01, press "K" to reach menu 02, then press "C" to summon the disk directory. Use the cursor up/down key to select the file called README and press "L" to load this file. When it has loaded menu 01 will return and then you may press "D" to display its contents. DISK CONTENTS When you display the directory of the program disk, note that DISK and everything beginning with MF constitute the essential program elements. These should all be included on every working copy you make. All components beginning with EXAMPLE are example files which have no lasting importance and need not be carried onto your working disk. FIX and FIX.HED are used to customise or apply fixes. CONV and CONV.HED are used to convert old Spectrum MASTERFILE files into a form ready to import into MF+3. Other components may be present. One of these is the README file already mentioned. README may describe other components. STUDY PLAN A suggested study plan follows. Read the manual entirely once, but don't pay too much attention first time around to chapters 5, 8, 9, 10, 11, 12, 13. Concentrate on chapters 1, 2, 3, 4, 6, and CAT/Load of chapter 7, initially. If you are new to the use of disks, study your Spectrum +3 manual on the subject of formatting, CAT, COPY, file names, back-ups, physical care. Load and study (and print if you have a printer) the README file, Load and study the example files. Explore. Once an MF+3 file is loaded, you can alter or even destroy it without danger, as long as you don't SAVE the results back onto the disk from which you loaded it. Much design effort has been expended in making MF+3 foolproof, you should not be able to put the program into a never-ending loop, or get into an unrecoverable situation. Re-read chapter 7, and practice SAVES and LOADS using the example files. Keep a ready-formatted disk at hand for saving files. Practice adding, amending and deleting data directly from the display, again using example files. Explore all the display "H" menu options, especially SORT. You should then study more deeply chapters 4 and 5, then practice creating a new file of your own and compose your own display formats. Don't be too ambitious at first, Just start with 3 or 4 data names, for example a simple stock list or a list of your treasured paper-backs. Read chapter 9 and then experiment with SEARCH and SETS. Study chapter 10 - try to find a use for table look-up, it is very powerful. If you have need to derive numeric data, such as averages, percentages, then study chapter 11 on Field Calculation. Read chapter 8. If you wish to use your MF+3 data with other packages, the EXPORT and IMPORT functions should be mastered, again using the example files. Try re-keying a file using the export/import functions. Refer to the glossary in chapter 14 if you are unsure of the terms we use. KEY NOTATION AND PROGRAM DIALOGUE In this manual we generally refer to Spectrum +3 keys using square brackets, for example [A], [B]. Keys with words on them are as shown as for example [ENTER], [BREAK]. The space bar is [SPACE]. The two cursor keys to the left of [SPACE] we call [LEFT] and [RIGHT], and those to the right of [SPACE] we call [UP] and [DOWN]. Where [SYMB-SHIFT] is required to be held down while another key is pressed, we use the notation such as [SYM F], meaning "hold down [SYMB-SHIFT] and then press [F] Note that [<] means [SYM R], and should not be confused with [LEFT], and similarly do not confuse [>] or [SYM T] with [RIGHT]. The square brackets characters which are normally available only as extended mode characters on Spectrum, we have made more readily available via [SYM Y] and [SYM U] respectively. You will need to make use of these if you wish to specify field calculations. MF+3 does not recognise extended mode and graphic mode characters, and neither does it use token words. TEXT EDITING All text entry and alteration is via a common text editor, which uses screen line 21 to echo the text being edited, and line 23 (the bottom of the screen) to remind you of CAPS lock and insert mode status. A steady bright white cursor shows where the next character will be keyed, and the cursor position is shown in line 23. A prompt message, e.g. "Give file name" will usually be shown in line 20 Just above the text line, during text editing. Generally, data fields can be up to 254 characters of text - far longer than the width of the edit line. But the editor scrolls the text left and right to keep the cursor in view. any attempt to key more text than the context allows will beep a warning and ignore the key just pressed. Text entry is normally completed using [ENTER], regardless of where the cursor is. But [BREAK] also terminates and is usually taken as a back-out. For example, if you start to edit some data you can abort via [BREAK] without altering the original data. [CAPS] can be used to lock capital letters, and this state is shown in line 23 with the legend "CAPS". The editor always starts in overstrike mode, which means that any character covered by the cursor is overwritten by the next keyed character. But you can switch the editor into insert mode via the [UP] key, so that keyed text always shifts to the right any text under and to the right of the cursor. [UP] is in fact a "toggle" and pressing it a second time reverts to overstrike mode. When in inert mode, the legend "insert" is shown at the bottom of the screen. The [DELETE] key works as normal, deleting text to the left of the cursor. But it is also useful to be able to delete text under the cursor and pull the rest of the text back from the right, leaving the cursor in the same position. We have made the [EXTEND-MODE] key do this. MENUS AND PROMPTS MF+3 is said to be menu-driven, as opposed to command-driven. With menus you are given a list of possible actions from which to choose. A command-driven system generally requires that you learn a language first! A menu is a list of possible actions from which you select one by pressing an indicated key. To assist in referring to menus, most are given a number. For example, the initial menu is numbered 01. Some menus are too large to show in one piece and offer a continuation, but they respond regardless of which part is shown. Some menus occupy centre screen, others occupy the bottom four lines. A prompt is a short message in line 20, inviting either a single- key response, or a text response. You can always tell which, since the text editor cursor appears when in text mode. Some prompts are one-line menus, and take priority over any menu still showing in centre screen. Some prompts require no particular key, and end with "[Any]" which simply means "Press any key to continue when you have read this message". The prompt area is also used to inform you when MF+3 is busy doing something, such as loading a file, or searching, or sorting. For clarity we show menu response keys in upper case - but there is no need to use [CAPS] when responding to a menu. Not every menu option will respond - for example, menu 01 [D] will be ignored if there is no file present. Finally, note as in the previous sentence how in this manual we refer to a menu response, quoting the menu number and the response key, e.g. menu 01 [D]. VIRTUAL SCREEN The main use of the screen is to allow you to view your file data. We have allocated the first 20 screen lines for this purpose, reserving the bottom 4 lines for prompts, text editor, and file statistics. But the top 20 lines are not limited to 32 columns, rather they are a window onto a virtual screen of 96 columns. The main reason for this is to allow the design of suitable displays for printed output. While displaying data, you will find that [<] and [>] can be used to move the window from side to side, in jumps of 16 columns. We call [<] and [>] the side-scroll keys. Do not confuse them with [LEFT] and [RIGHT]. The current position of the window can be seen from the number at the bottom right corner of the screen. This is 32 48 64 80 or 96 and is the column of the right-most edge of the window, counting from 1. The side-scroll keys are not always active, for example while using the text editor these keys simply enter "<" and ">" characters. Chapter 2: FILE CONCEPTS FUNDAMENTALS Consider the following pieces of information: D J Williams 0227 566198 24 Acacia Avenue, Cambridge In general, we can call this DATA. In particular, each of the three items we will call a FIELD. Where data fields are associated with each other, such that for example the telephone number and address shown are those of "D J Williams", then one would usually arrange that the fields are stored together. This is like writing them all on the same index card; this grouping of data we call a RECORD. Now, suppose that we have another set of data: F Thorpe 01-507 5561 2 The Drive, Barking, Essex Clearly this looks similar in structure to the earlier group, and indeed we can regard this as another record of the same FILE. But now consider the following: Nocturn in E flat F Chopin J Lill Philips BBL 7384 Assuming that this musical data is mutually associated, i.e. the work is composed, performed and recorded as described, then this too constitutes a RECORD, but most assuredly not in the same FILE as the other two examples. We would not intermingle pages of our address book with pages of our music library catalogue. Thus we can define a FILE as a set of RECORDS of similar structure, each record comprising associated data FIELDS. This definition would apply to virtually any computer filing system. Where computer filing systems differ is in the number and length of the fields permitted, the file capacity, disk storage method, and so on. But the scheme of FILE - RECORD - FIELD is universal. We now move from the general to the particular, and discuss how MF+3 manages your data files. THE RAM FILE APPROACH You will begin a MF+3 session either by loading a file from disk, or by creating a new file directly. Throughout the session, the whole file being processed will reside in the Spectrum's memory, which can be thought of as another very fast disk drive. At the end of a session, or when required, you will save the file onto a real disk. Until this save is done, the charges you have made to your file cannot be said to be permanent. It is worth pausing here to observe that some computer filing systems may have a greater file capacity than MF+3. Such systems generally operate by having only a small part of the file in memory at a time. They tend to be "fixed-field" systems with disk space pre-allocated in anticipation of file growth. They are also very slow at searching, browsing, and sorting. And they make heavy demands on the disk drive, especially when the file needs to be re- organised. MF+3 by contrast is swift, flexible, and lets the drive have an easier life. We have established that MF+3's unit of disk storage is a FILE. Since the whole file must fit in RAM, the capacity of any one file is limited to the Spectrum RAM disk space rather than real disk capacity. MF+3 can use up to 62K of the RAM disk on your Spectrum +3 machine. The overwhelming advantage of MF+3's RAM-based file processing is that of sheer speed of search and display. And wear and tear of the disk drive and disks is minimal. MF+3 FILE ORGANISATION SUMMARY An individual field can contain between 0 and 254 characters of data, and furthermore, all fields are variable-length. This is quite unusual among filing systems. The main advantage of variable- length fields is that there is no wasted space. MF+3 allows up to 60 fields per record, and since all fields are variable-length, so too are the records. However, there is a limit of about 2000 characters of data per record. The precise limit is in part a function of which attributes are used and how many data fields there are. The advantage of variable-length fields is that short records occupy less space than long records. This sounds obvious, but is not the case in many of the traditional filing systems where the maximum field length must be predetermined and allocated for every record. As already noted, the maximum number of fields in a record is 60, more than enough for most applications. In practice, between 3 and 12 are more usual. Each field may occur only ONCE per record, although a field can be used to hold a list of small items. Each field is known by its DATA NAME. A data name is a word or short phrase which describes the data, for example "Customer Name", or "Address" or "Invoice number". Each data name is also given a DATA NUMBER. Data numbers are used in table look-up operations and in calculation formulae - these are covered later. Also associated with each data name is an ATTRIBUTE, by which you say whether a field is character, numeric, or a date. The attribute affects the storage and display properties of the data. Data names and attributes are stored as part of the file. MF+3 has the ability to present your data in huge a variety of ways, and indeed several different ways even on the same file. What determines the style and content of the display is a FORMAT. A format is a special control record containing everything MF+3 needs to know in order to display your file data, such as the spacing, what field goes where, headings, printer options. There can be 10 such format records, one generated automatically by MF+3, and up to 9 more designed by you. These special records are saved as part of the file and can be changed at any time. Since there can be several formats in each file, each format must be assigned a code by which to refer to it. This is a single digit 0-9 and is called the FORMAT IDENTIFIER. KEYED AND UNKEYED FILES When creating a new file, you must elect whether or not it is to be keyed. A keyed file is always maintained in ascending sequence by its first data name, while an unkeyed file lets you place new records anywhere in the file. You must choose the most suitable system - but don't worry, there are ways to convert files from keyed to unkeyed, or to key by a different field, should the need arise. Probably most files have a natural key field, such as a surname, date or account number, and you would elect to have such files keyed. But consider a household insurance inventory, where you want to group assets by room or by some other arbitrary quality; without having to invent a "room code" perhaps an unkeyed file is simplest and best. - Summary of terms described above - FILE collection of similarly-structured data records. RECORD group of associated pieces of data FIELD unit of data within a record DATA NAME description of a data field DATA NUMBER number used to refer to a data name or field ATTRIBUTE whether data is character, numeric or date FORMAT specification of how to display your records FORMAT IDENTIFIER number (0-9) which identifies a format KEYED FILE one where records are sequenced by the first data field UNKEYED FILE one where records can be entered at any place. FILE DESIGN CONSIDERATIONS File design is the all-important first step to creating a new file, and it is best done with pencil and paper and with the computer switched off. Write down a list of probable data names to decide how to divide your data into fields within each record. Don't fall into the trap of over-organising your data, don't -divide for the sake of it. For example, there is usually no need to split a name into title, forename, other names, and surname. Just "Name" is sufficient. Likewise, there is seldom any need to break an address down into house number, street, area, town, postcode. Neither need you break an address into lines, since this can be handled all within one field as will be explained later. Just "Address" is usually sufficient. However, if you need to have a file keyed by postcode then of course postcode must be isolated as a discrete field. Sometimes it is not easy to decide what one record should comprise. For example, in a file of athletic performances - say swimming times for individuals - do you wish to record only the most recent time for an individual, or the last three times, or keep full performance history? Are you going to list successive dates and times all in one large text field, or raise a new record for each event? What if an individual swims four distances? Perhaps you need to treat each distance as a separate record, repeating the swimmers name in each. A field can comprise a list of things, but subject to an overall length of 254 characters. As far as MF+3 is concerned of course there is no list, just a lump of text. It may suit you to separate "sub-fields" with commas or line-breaks (as with an address for example) and take advantage of MF+3's ability to word-wrap text in several lines. Consider a music album index. You can have one large record per album, with the tracks described in Track1, Track2.... etc., or you can create one file record per track, each comprising Title, Performer, and Album title. In the first method you store the album title just once, but you cannot isolate one title from other titles in the same record. The second method lets you search and list all tracks by one singer, without having to show the other tracks. But then you have to repeat the album title for each track. The method you choose may depend on how you wish to search and display your data, and what degree of data duplication can be tolerated. Try to estimate the likely file size using the average amount of text keyed for a record, plus 8, plus the number of data names. Divide 62000 by this number, and the result tells you how many records your file can hold. If the result is too small, either consider abbreviating some of the data, or splitting the file into two or more. The sequence of the file is usually important for browsing or if you wish to make printed reports of all of the file. Try to decide what field is the most important and make it the key field. If there is no obvious key, leave it unkeyed. But whether or not keyed, you can always sort the file by any field on demand. We have not discussed how to format the data - because this is not important from the point of view of file design. But we have aired the main considerations and with your list of data names at the ready you can now switch on the computer, load MF+3, and start a new file. Chapter 3: MAIN MENU OPTIONS The main menu (01) represents the main control panel for MF+3. Most of the options offered by this menu are covered in greater detail elsewhere in this manual, but we will summarise all the options here. First, note that menu 01 is in two parts although it does not matter which part is in view. The full menu is below left, with a brief commentary to the right: 01: Main Menu File <--> disk K --> Menu 02 CAT/load/save/merge etc. Display and Print D --> Menu 05 display mode Search the file S --> Menu 04 Search mode Select all records E Recs:xxxx Sel:-->xxxx Calculate C Make field calculations Insert new record I New record, then display mode Show RAM disk use M Show used (dead) Spare bytes Quit Q --> Finish using MF+3 Begin a new file B Say whether keyed, how many names Data names/attr N --> Menu 06 data names/attributes Delete sel. records SYM_D Recs: xxxx Sel: xxxx-->0000 Immed format alter SYM_F Menu 08 format mode current format maintenance F --> Menu 07 format mode Maintain LU file L --> Menu 14 LU record insert/alter/erase Reorg M disk R Set used xxxx (xxxx-->00000) Printer port P Set Centronics or Serial print Show version V and copyright etc, then --> Me nu 01 (cont) X Show other half of this menu Option [K] This takes you to menu 02 in order to perform almost all of the disk-related actions. When starting an MF+3 session, this will typically be the first thing to do, followed by menu 02 [C) in order to view the disk catalogue in order to load a file. Option [D] This takes you to DISPLAY ode to view/alter/print your data. Option [S] This takes you to SEARCH mode to isolate records on the basis of what data they contain. Records so chosen become SELECTED, and only these records are eligible for display mode actions. Option [E] This is the quick way to make ALL records selected, so that the bottom line shows "Sel:xxxx" the same value as "Recs:xxxx". This option is also available via search mode menu 04 [E]. Option [C] This executes calculations on all selected records, under the control of formulae stored in the current format. Option [I] This creates a new data record by prompting you with each non-reserved data name. Option [I] is also available from display mode. Option [M] This shows the usage of RAMdisk bytes, via the legend RAMdisk bytes: Used=xxxxx(xxxxx) Spare=xxxxx The figure in brackets shows how many bytes are reclaimable via REORG [R]. Option [Q] Ends the session. If a file save seems pending, you are invited to divert to menu 02 to save the file to disk. Option [B] This creates a new file, warning of any pending save first if required. All MF+3 needs to know at first are : a) whether keyed b) how many data names you wish to reserve. Option [N] This allows you to alter your data names and attributes, although you cannot change the number of data names. Option [SYM D] This is the quick way to erase all selected records from the RAM disk, and as with most erasures you must confirm this via [Y] or else use another key to back out. Note that the erasure does not affect the real disk and so is not permanent until you save the file. Option [SYM F] This is a short-cut way to enter format review at menu 08 for the current format. The longer way is menu 01 [F] then menu 07 [V] followed by format id. Option [F] This takes you to Format mode menu 07, from where you can then create or alter or copy or erase a format. Option [L] This takes you into the LU file where you can insert or erase or alter your text look-up records. It is a bit like a display mode on a two-field file. Option [R] This reorganises the RAM disk, reclaiming dead space left over by erased or length-changed records. Note that MERGE and IMPORT invoke REORG automatically before they start to extend the file. Reorganisation is not likely to take longer than 5 seconds! Option [P] This reminds you of where printer output will be directed, in terms of Centronics or Serial, and lets you toggle from one to the other. Option [V] This displays the initial loading panel showing the program name, version, copyright notice, and licence serial number. The version and serial number must be quoted before support can be guaranteed. Option [X] This just switches between the two halves of menu 01. FILE STATISTICS The bottom three lines of the screen usually show information about the current file. These lines are shared by some menus and by the text editor, but are restored when the menus or editor are not in use. A typical layout is File: CUSTOMER Format:3 (line 21) Key:Customer name (line 22) Recs:0568 Sel:0401 LU:0049 (line 23) The file name (and file suffix if any) are displayed in line 21 following tile word "File:". The current format identity ;s seen at the extreme right of line 21, after the word "Format:". For a keyed file, the key data name is shown in line 22. For an unkeyed file, the legend "(file not keyed)" is shown. Line 23 shows the total number of data records "Recs:xxxx", how many of these are currently selected "Sel-xxxx". It also shows how many LU records there are "LU:xxxx". The far right of line 23 reflects the position of the 32-column window over the virtual 96-column upper screen. The two digits show the virtual column of the right edge of the window, so "32" is the normal "home" position. PROGRAM OVERLAYS Once MF+3 has loaded itself, most of its operations require no further use of the program disk. But it is a large program, and some functions have to share RAM. This means that certain tasks require that the program disk is inserted so that a piece of code called an overlay can be brought in. When this Happens you will see the message : Put program disk in A: [Any] We have arranged things so that this is a relatively infrequent interruption, and once an overlay is in there is no request to re- load it unless the overlay area has been used for something else. The functions which require an overlay are Format maintenance File merge, Import or Export LU file maintenance Calculation via formulae Also, display mode [S] which sorts the file uses the overlay space. Therefore, any of the above functions will require a re-load if requested after a sort has been performed. Chapter 4: CREATING A NEW FILE AND INSERTING RECORDS In this chapter we describe how to create a new file from scratch. A central task is to allocate data names to your fields, and decide which data attributes (character, numeric, date) are to be used. We discuss the different ways of holding data (called attributes). Then we describe how data records are added to the file, and the main considerations in respect of data entry. DATA NAMES AND NUMBERS A data name is a word or short phrase, up to 22 characters, describing a field. For example, we might use data names like: Customer name Address Account ref Date of invoice Telephone Each data name is given a number: 01 for the first, 02 for the second, and so on. We use these numbers for brevity when coding calculation formulae and when exporting data. CREATING A NEW FILE Use [B] at menu 01. If an un-saved file already exists in RAM then you are given a chance to save it instead. Otherwise, you are asked if the new file is to be 13 keyed : Is file to be keyed? Y/N Reply [Y] if the file is to be keyed; any other response is taken to mean [N]. Next you are asked: How many data names? Reply with any number 1-60. Consider adding a few extra "reserved" names, as this makes it easier to add more data fields later. Each spare name costs just one byte per record. MF+3 immediately displays them as "(spare)", and invites you to alter them. How to alter them is described in the next paragraph, but already your file is created - MF+3 just needed the answer to those two questions. A new file will show a name of "NEWFILE" in the control panel, until you save the file onto disk. ALTERING DATA NAMES AND ATTRIBUTES Menu 01 [N] takes you to menu 06 with the selector bar cursor over the first of the file data names. Each line shows one data name, with its allocated data number to the left, and attribute to the right, for example 01: Name Char 02: Address Char 03: Contribution Num 04: When last contacted Date 05: (spare) Char As usual, keys [DOWN] and [UP] can be used to select a target, changing screen pages where necessary. You are also offered menu 06 after initiating a new file, as described in the previous paragraph. Your menu options - apart from selector movement - are: N=name A=attribute P=print X=exit Option [N] invites you to enter a new data name where the selector bar is: Give data name The name can be up to 22 characters long. You cannot edit an existing name, only replace it. Option [A] lets you set the ATTRIBUTE of the name where the selector bar is, and offers the choice - C=char N=numeric D=date For most fields, you will probably leave the default of "character". Numeric format is used in order to be able to make use of certain format options, such as numeric column-total. For any quantity data or monetary data, you will probably use numeric attribute. Use date attribute only for this-century dates, as described a little later. Although you may alter names and attributes at any time, for example to change the spelling of a data name, it is not advisable to alter to/from date attribute once data records exist since dates are converted for storage. When you add a new record to the file, data will be prompted using the data names in data number order, but omitting any reserved names. RESERVED DATA NAMES A reserved data name is simply one beginning with an open bracket, e.g. "(spare)". The space penalty for reserved data is just one byte per record per reserved name. When you create a new file, all its data names are reserved and of course you must un-reserve those you wish to use. Reserved data names do not prompt for data when building a new record. Note that if you have fields which are calculated rather than keyed, or which you wish to leave empty initially, just start their data name with an open bracket, for example "(Total Marks)" or "(Suppl. Notes)". There is no direct way to change the number of data names once a file has been started. Hence the wisdom of reserved names. DATE ATTRIBUTE Dates are a very important kind of information, and suffer from the fact that people and computers have quite different needs where dates are concerned. If you need only to record the year (e.g. book publication date, vehicle registration date) then there is no problem; just use two characters such as "86" and give the field a CHARACTER attribute. To hold more precise dates, such as invoice date, renewal date, then you probably need to store day, month and year. And here is the main problem. People are more comfortable with "14th February 1987" while computers find it easier to process "870214". Consider the task of evaluating a date in terms of whether it is earlier than or later than a particular date; treating the date as a pure number, with the year first, makes the most sense. MF+3 offers a compromise solution. If you give data a DATE attribute then the following processing is brought into operation. a) When you enter or alter that field the program makes a cursory validation and BEEPs a warning if the keyed data looks unsuitable. The program checks that your text starts with a day number 01 to 31, and that the rest of the text starts with the first three letters of one of the months. If the last two characters are numeric, then this is taken to be the year in this century; otherwise if you omit year, the last year entered is assumed. b) Examples of valid dates, and how they are keyed and then re- displayed Keyed as Displayed as Comment -------- ------------ ------- 1jan88 01 Jan 88 01 JAN 1988 01 Jan 88 31NOVEMBER1983 31 N.,,63 Does not know 31 too big for November 14 feb 87 14 Feb 97 5feb 05 Feb 87 takes previous keyed year 25 December 1896 25 Dec 96 Century ignored 1Separation100 01 Sep 00 yes, sad isn't it c) Examples of invalid dates, which are displayed exactly as keyed are: 1st January 1983 "st" present. month recognition Aug 86 No day number 1984 No month etc 32june86 day too big Aug 1st No day number at start d) If validation falls, the program BEEPs but accepts and displays the data exactly as keyed. It is up to you whether you correct it or not. You may hear a cascade of beeps when importing invalid dates into a file which uses the date attribute! e) If the validation is successful, the date is converted into binary year month and day. This internal format occupies just four bytes, including its own length. f) Internal dates are always expanded on display/edit/export, to the form "dd mmm yy". g) It is easy to search on dates on the basis of later/earlier than. h) Imported dates are treated just as if they are keyed. This system is not meant to be rigorous. Any month can have 31 days; there is no leap-year logic; it is geared to the present century; and there is no day-of-week logic. Even so, we believe it will suit most applications. If you need to hold dates earlier than 1900, as in genealogy, it is best to keep to character attribute. NUMERIC ATTRIBUTE This attribute is designed for "pure" numeric data. Any non-numeric characters are ignored, with the exception of leading minus sign "- " and decimal point. You should not enter other characters -even currency symbols are best left to the format logic, covered later in this manual. Perhaps in error you may have entered "D Smith"; this will simply be displayed as "01" or "0.00", depending on the format options. To assist in troubleshooting this circumstance, use [EDIT] to re-display the data in the way it was keyed, and "D Smith" or whatever will be seen in the edit line. If a field can genuinely contain either a number or some other text, give it character attribute not numeric. FORMAT ZERO The process of creating a new file or altering a data name generates the standard format, reference "0". This format shows data as one record per screen, listing data names down the left, and record data to the right. Only the first 20 data names are used in format 0, and only the first 73 characters of each field are shown. It is possible to alter format 0, but not advised since any use of menu 01 [V] will simply undo your changes. The main purpose of format 0 is to enable you to display your data even if you have not yet composed any of your own screen formats. We call it the default format. ADDING RECORDS TO THE FILE For keyed or unkeyed files, you may use menu 01 [I] to create a new record and insert it into the file. Each field of the new record is prompted using its data name, and you may key/edit up to 254 characters per field. The current display format is used to display the record as each field is entered. All data fields are prompted, irrespective of whether or not they are shown in the current format. Reserved data names (those in brackets) are not prompted. If you have no data for a particular field, just press [ENTER]. A new record inserted into a keyed file is always placed into its correct position. If the identical key already exists the new record is placed after its twin(s). It is not regarded as an error to have two or more records with the same key. A new record inserted into an unkeyed file via menu 01 [I] is placed at the end. After the new record is completed, display mode is resumed starting at the newly created record. Any errors can therefore be corrected immediately by steering the field cursor to the target data and pressing [EDIT]. For an un-keyed file, one can insert a new record after any target record, from display mode option [I]. Display mode [I] also works for keyed files, except that the new key determines the insertion point, not the current target record. DATA ENTRY CONSIDERATIONS When entering data into date-attribute fields, listen for the warning beep if the date looks bad, and correct it if necessary after the rest of the data has been entered. When entering data into numeric-attribute fields, there is no need to key in money fields if there are no pence. "5.00" and "5" will look the same, but the latter will occupy less file space. When entering data into a character-attribute field, note that any leading or trailing spaces are dropped. Also, any embedded spaces in excess of one are simply a waste of space as the word-process logic reduces them to single spaces on the screen. Where data is displayed in a single line however, one can enter "_" characters which display as "hard" spaces. This underscore character we call a LINE-BREAK, and is otherwise used to force a change of display line in multi-line fields such as addresses. Without line-breaks, standard word-wrap is used to determine where to change lines. Try to be consistent in your use of upper and lower case, it looks so much tidier. More importantly, remember that lower-case "a" sorts AFTER upper-case "Z", so for key fields make up your mind what case you will use, and stay with it. If your key field has date attribute, it will naturally file your records in date sequence oldest to most-recent. If your key field is numeric (whether numeric attribute or not), beware that the numbers 1, 11, 1000000 all sort before 2! This is because key sequence is based on a simple character string comparison. The only way to sequence a keyed file in the true numeric sense is to ensure all keys are the same length, with leading zeros where required. The following sections (WORD-WRAP, LINE-BREAKS, SHUFFLE) apply only to data entered in character-attribute fields. WORD-WRAP We will see later that the formats you design can specify that a field of data is displayed in a paragraph one or more lines deep. For example, a field which contains narrative such as "They are slow payers, so chase them every Monday." can be displayed as : They are slow payers, so chase them every Monday. When you enter or alter this text, you need not pay any regard to how it displays, word-wrap logic takes care of this. Word-wrap logic recognises only space characters and line-break characters (see below) as points at which text can be split. A comma alone is not sufficient, it must be followed by a space to facilitate word- wrap logic. LINE-BREAKS Sometimes you will want to enter a narrative where change of line is where you choose, not where word-wrap chooses. The obvious case is an address. To effect a forced change of line, simply enter a "_" line-break character where required. For example, we would enter an address as follows : 7 Station Road_Epping_Essex CM16 4HA Then, given a suitable of paragraph in ones format, this data can be made to display as: 7 Station Road Epping Essex CM16 4HA Notice that the line-break characters are not shown. If MF+3 is not given enough lines then it will either fill up the last line or truncate the display or both. SURNAME SHUFFLE A commonly stored kind of data is a name, especially that of a person. You may wish to file surname, title, initials as three separate fields; but this is cumbersome, and does not lend itself to producing tidy address labels. Consider the name: "Dr P J Robinson". if this is the key field, by which the file is sequenced, then Dr Robinson's record will appear among the D's. We could key the name as: "Robinson, Dr P J", but this would look rather miserable on a label. MF+3 offers a simple solution, called Surname Shuffle. You just key the name the way you wish the computer to sequence or search it, and use a special character to show how to re-arrange the data on display or export. This special character we call the SHUFFLE character, and is "<" Thus we would key our example as Robinson Calculate ............. C Alter .......... EDIT Print ................. P Erase Data ..... DELETE Print one record ...... Q Assign to set ... A Erase record .......... E Unassign set .... U Insert record ......... I First page ...... B Sort .................. S Next page ....... ENTER Format ................ F Back one ........ SYM_H Window right .......... > Go to number .... G Window left ........... < Key pos ......... K Exit .................. X (cont) .......... H (back) ................ H The menu is painted at the extreme right of the virtual screen, and in fact remains there until the display is updated. The menu will respond directly, so it is best to avoid [Q] while the menu is still on screen, as it will become included in the single-record print THE TARGET RECORD This means "the record we wish to alter/erase/print". if there is only one record on the screen, then this is the target record. If there are two or more records on the screen at one time, then the target record is the one showing a field cursor. . . . FIELD CURSOR This is a highlighted field in one of the displayed records. On a freshly drawn screen page, there is no field cursor shown initially. If you have not made any particular colour effects, the field cursor will be bright white. Many display functions require the field cursor to be present first, e.g. [EDIT]. But if cursor is absent the function mimics [RIGHT] which then highlights the first field in the first displayed record. Take care with wide formats where the field cursor can disappear off the screen to chase fields outside the present window. You can use side-scroll to determine where the missing field cursor is. When a cursor key is pressed, a field cursor normally appears; this identifies the target record and field. [UP] and [DOWN] move up or down by one record within the currently displayed screen. [UP] and [DOWN] are not useful except where there are several records per screen. [RIGHT] and [LEFT] move the field cursor to the next or to the previous field within the target record. The purpose of the field cursor is to show which data is to be altered, or to identify a target record. You will see that the cursor cannot be moved over headings since they cannot be altered. Wherever the field cursor appears, the data name of that field appears at the left of line 20. As [LEFT] and [RIGHT] are used, so this data name is constantly replaced, telling you exactly which data is under the field cursor. ALTERING DATA [EDIT] is used to alter whichever field is lit by the field cursor. The existing data, if any, is pulled into the edit line (21) and the text edit cursor is offered. All the editor functions may now be used, and the data can be extended up to 254 characters. [BREAK] will back out, leaving the original data unchanged. Otherwise, on completion of the edit via [ENTER], the record is re-displayed with the changed data in place. If you alter the key field, the record is immediately re- positioned to keep the file in key sequence. After a very short pause, the display is resumed from the altered record. ERASING DATA To erase data under the field cursor, press [DELETE]; there is no confirmation requested, and no back-out from erasure at the field level, so use this key with care. You cannot erase the key field, since a keyed file must have key data in every record. Note that you can only alter or erase data which is displayed by the current format. ASSIGNING TO A SET Display mode [A] assigns the target record to one of sets 1-8, which you choose in response to the prompt : Assign to set 1-8 Press any key [1] to [8], or back out with [BREAK] or [ENTER]. [I]- [8] sets on the corresponding SET flag in the record. These flags are fully explained in Chapter 9, FILE SEARCH. The current flags in the target record are echoed in the right of line 20. UNASSIGN FROM A SET This is the opposite from the Assign function and is done via [U] which asks Unassign set 1-8 Press [1] to [6] or back out with [BREAK] or [ENTER] CALCULATE To calculate (or re-calculate) data in the target record, use display mode [C]. No other records are affected, in contrast with menu 01 [C]. Only formulae present in the current format are used. If there are no formulae, no update takes place. Otherwise, the record is updated and re-displayed. For more information, see Chapter ll:FIELD CALCULATION. ERASING A COMPLETE RECORD The target record may be erased completely by using [E] but must be confirmed using [Y] in response to : [Y] to confirm erasure If you press [E] by mistake, back out by pressing any key except the [Y]. INSERTING A NEW RECORD Use [I] to begin a new record. For a keyed file the new record will be placed in the correct key sequence automatically. For an unkeyed file, the new record is placed immediately after the target record. If there are no records shown then you can only insert a new record using menu 01 [I]. SWITCHING FORMATS Use [F] to move from one format to another, resuming at the same target record. The system changes to the next available format, or resumes format 0. [F] thus works in a cyclic manner. INTERRUPTING THE DISPLAY Where more than one records per screen are shown, it is possible to interrupt by pressing any key. Thus for example when switching through several formats one need not wait for each screen to fill. BROWSING It is often useful to "browse" through a file, and where more than one screenful of records are selected there are several useful ways of re-positioning to a different part of the file. Browsing is often more convenient than the more formal SEARCH process. To move to the next page, use [ENTER]. To restart the display from the first selected record, use [B]. To go back by one record, re- painting the screen, use [SYM H]. The next two paragraphs describe rather more powerful browse options. GO TO You may use [G] to "GO TO" a specific record by giving its selected number. If all records are selected, then this is the same as the absolute number. But if not all records are selected, the number is relative to the selected sub-set file. [G] yields the prompt : Go to selected record no: Reply with any suitable number. If the number is too large then just the last record is displayed. "G9999" therefore means "display last record" and is a quick way to reach any column totals of a large number of selected records. FIND For a keyed file, or for a sorted display, you can use [K] to re- position the display from any chosen key. You are asked Give key to find For example, if you want to look at the records whose keys begin with "M", reply with this one-letter key. You can give a longer search argument, but one or two characters are normally all that is needed. The display is resumed at the record equal to or greater than the target key. If the target key is higher than the highest selected key, the display is left unchanged. The key is case-specific, in that "A" to "Z" are lower than "a" to "z". Only the key field or the sort field is searched. If you need to locate records based on the contents of other data fields, you must make use of search mode. PRINT SELECTED RECORDS This is the main print function, and is invoked by [P] when in display mode. The use of display mode [P] asks - Print to: P=printer D=disk You reply [P] to use the printer, or [D] to send a print image to disk. The letter is discussed in Chapter 8 on EXPORT. [P] prints all selected records starting with the first selected record or, if currently sorted, starting with the first sorted record. Thus the printed output can either be in file order, or sorted. (SORT is covered a little later.) A message informs that printing is in progress -- Printing-- To abandon printing, unready the printer and press [BREAK]. If you have initiated printing with no printer attached, rescue yourself with [BREAK]. An such use of [BREAK] will return to menu 01. (The same rescue method applies when printing data names via menu 06 [P]. The use of the paper will be governed by the Printer Options for the current format. Format mode menu 08 [P] is where you set these options, and is discussed more fully in the Chapter 5: DISPLAY AND PRINT FORMATS Boxes are not printed, neither are panel colours acknowledged, even if you have a colour printer. Unless you have specified "inf" in the printer options, printed output is in pages where each page starts by repeating any headings above the data zone. "inf" means "infinite" and suppresses page treatment. Either way, forms may be continuous or single-sheet. We have described the following elsewhere, but just to remind you: A heading of "%PG" in the format will generate page numbers from 1 to 999. This appears only on paper, not in normal screen display. See "Printing Notes" on the next page. PRINT SINGLE RECORD A variation of printing is display mode [Q], which prints just the target record. This might be useful for picking off specific labels without having to isolate records via SEARCH. [Q] prints just the DATA ZONE of the target record. If there are several records on screen, under a common heading area, the heading area above the first data zone is NOT printed when [Q] is used. If your format is just one record per screen, it is usually better to have the data zone fill the whole screen in order to let [Q] print lines 0-19. Do not use [Q] without first clearing the display menu from the right side of the virtual screen. If you have used [H] one way to clear it without losing the target record from the screen is to press [F] until the same format resumes. Escape from [Q] if there is no ready printer, is via [BREAK]. There is no print-to-disk variation for single-record [Q] option, and no page number action. PRINTING NOTES Except for "Inf", each page ends with a Form Feed. This applies to the last page even if it is not full. The maximum number of records printed on each page except where "Inf" is used, is INT((FD-HD- Ll)/DZ) where: FD Is the specified forms depth no. of lines, HD Is the number of lines reserved for headings above the data zone DZ Is the number of lines in one data zone. LI Is the pitch, how many lines per inch. One inch separates each page, where the forms are continuous and the depth is not "Inf". Beware using 10 characters to the inch across ("Elite -" = Pica) since this can cause line overflow and hence page overflow if any line goes beyond column 80, assuming your printer is limited to 8" head travel. Short lines do not overflow since MF+3 does not print trailing spaces in a line. The default setting is Elite which prints 12 characters per inch across. This should never cause line overflow as long as left margin is zero. See chapter 3 re parallel/serial port control. See chapter 13 re printing of sterling symbol. SORTING THE FILE It may be desirable to display or print selected records in a sequence other than that of the natural key. Or perhaps a file is un-keyed and you wish to show it sorted by one of its fields. A fast and powerful sort function is provided via display mode [S]. [S] lists the data names and invites you to use the selector bar to choose the field by which to sort. Note that it will not accept the first data name for a keyed file, since this is already the file sequence. it will accept [BREAK] as a back-out. Having selected a field you are asked Give key length 1-25 This tells MF+3 how much of the data to take for its compare logic. A small value will give a less precise sort but will allow a larger sort capacity - we will discuss this shortly. If you reply with just [ENTER] then it assumes the previous used sort key length, or 6 if you have not sorted before. Then: -- Sorting: key length is xx -- MF+3 informs you it is sorting and there is a pause of a few seconds while this takes place. On completion of the sort, the display is resumed but now in ascending sequence by the given field. Certain functions are suppressed while the display is shown sorted. These are [E], [G], [F] and [1]. Also, you cannot alter the natural key field while sorted. Leaving display mode, via [X], will abandon the sorted sequence. Also, using (S) then [ENTER] will resume the natural display sequence. You may sort as often as you like, subject to the limitations discussed below. The KEY POS function [K] may be used with a sorted display, whether the file is keyed or not. While the sorted sequence operates, [K] assumes that the target field is the same one as used by the sort. The sort works by extracting the first N characters of the target field, where N is the key length you specified. Numeric fields will be treated as character, so that "1","100" and "10000" will all sort before "2", for example. Sorting requires RAM and the space reserved for this is 11776 bytes. Each selected record needs (S+N) bytes. For example, for a sort key length of 6, each record needs 5+6=11 bytes, and so 1070 records can be sorted. If there are more records selected than can be accommodated by the sort, MF+3 will just sort what it can and warn with the message : Sort limited to xxxx records [Any] Sorting has no permanent effect on the file's physical sequence. LEAVING DISPLAY MODE Use [X] to exit to main menu 01. If you later return to display mode, the display is resumed from the first selected record and any earlier sort will have been forgotten. Chapter 7: Disk AND FILE MANAGEMENT DISK FUNCTIONS MENU (02) Nearly all of the functions which make use of the disk drive are done starting from menu 02, which is reached via menu 01 [K]. The exceptions are a) print-to-disk and b) program overlay, detailed elsewhere. Menu 02 is used to initiate all file loads and saves, and looks like this: 02: Disk functions CAT/Load/Merge/Import ..... C Drive select A/B .......... V Save all .................. S Save selected recs .... SYM_S Erase a file .......... SYM_E Export ASCII data ......... E System date ............... D Main menu ................. X DISK CATALOGUE To view the disk catalogue, use menu 02 [C]. This lists the first 20 files showing simply the name, suffix, and how many K. It also reminds you which drive is currently selected (usually A:) and how much free space there is on the disk. The bottom of the screen shows a small menu which includes a reminder that [UP] and [DOWN] can be used to move the selector bar cursor. If there are more than 20 disk files then hold [DOWN] until it forces a change of screen page. likewise, [UP] will force a back-page action. If all you wanted to do was view the catalogue, then use [X] to resume the previous menu, 02. Note that when we talk of a file shown in a disk directory, everything is a "file", but not necessarily an MF+3 data file. All components are listed just as if you had used BASIC CAT command - except that BASIC CAT does not let you scroll backwards again! DRIVE SELECT If you have a two-drive system, menu 02 [V] will switch from one drive to the other, and then shows the disk catalogue of the newly selected drive. The currently selected drive is shown as part of the disk catalogue display. In fact, drive select also works with just a single drive, producing the message "Please put the disk for B: into the drive then press any key". This is harmless (and useless) and only causes a request to revert to drive A whenever a program overlay needs to be loaded. FILE LOAD To load a file, first view the catalogue via menu 02 [C]. Then steer the cursor bar to the name of the file you want to load, and press [L]. You will see the message: -- Reading disk -- And on completion, main menu 01 is resumed directly, and the file statistics will reflect the file now loaded. You can then remove the disk from the drive if you wish, as the whole of the file will have been copied onto the RAMdisk. If you attempt to load a file when your RAMdisk still contains a previous file, which was not been re-saved, you will see the message: File altered - save it? [Y/N] If you then press [Y], you are diverted to File Save mode. Otherwise, [N] will abandon the current file and proceed with the requested load. If the file being loaded is not a proper MF+3 data file, you will be admonished with the message: Error code 07 [Any] No harm will be done - just press a key, ask for another catalogue display and try selecting the correct file. FILE SAVE To save a file, there is no need to view the catalogue first, although you may wish to do so to check if there is going to be enough room. Save is initiated by menu 02 [S]. You are asked: Give save name or just ENTER When saving a new file for the first time, give it a name here. If the name is not suitable, the save is aborted immediately with "Error code 20" message; just start the save again with a valid name. If you simply press [ENTER] by itself and the file is saved under the same name that it had when loaded. This will be normal procedure for saving an updated file. During the save you will be informed: -- Writing to disk -- On completion, menu 02 is resumed. You may wish to check the directory that all is well, although if there any problems the save would end with an error message. Note that the previous version, if any, gets renamed with a ".BAK" suffix, and any previous ".BAK" version is erased. BEWARE: If the save could not complete due to insufficient disk space, the rename will still have taken place because that is how Spectrum +3 DOS works! FILE NAMES MF+3 files can have any name which is allowed by Spectrum +3 DOS, i.e. a file name of 1-8 characters, and an optional file suffix of 1-3 characters, as covered in your Spectrum +3 manual. However, MF+3 does not allow you to specify the drive as part of the name. It may be useful to make use of file suffix to remind what kind of file it is, but try to keep the main name unique regardless since file suffix of all automatic back-up versions is ".BAK". PARTIAL FILE SAVE A variation of file save is via menu 02 [SYM S], which is very similar to normal save except that any unselected records are omitted from the save. This is therefore a convenient method of saving a file of just selected records. The chances are that you should be saving this file under a different name, and so you are not given the option of defaulting the file name - you must key the save name. FILE ERASURE There are two ways to "clear dead wood" from a disk. One is to use [SYM E] with the catalogue in view and the cursor bar over the name of the file you wish to erase. Take a good look before you do this, because there is no back-out. This is why we made it a two-key response. The second way is to use [SYM E] directly at menu 02, which then asks: Erase which files ? You can enter the name of the file you wish to erase - but now it can include wild-cards * and ?, so that a family of files can be erased at once. Perhaps the most-used response will be "*.BAK" to erase unessential back-up files. You can erase any files - not just MF+3 data files - using [SYM E]. If you get an error message "Erase failed [Any]", this is probably because the disk is protected. Un-protect it and try again if required. After an erasure, MF+3 automatically re-displays the revised catalogue. SYSTEM DATE AND FILE DATE You can if you wish make use of a date-stamp on printed output, and on files to remind you when a file was last updated. Menu 02 [D] displays what MF+3 thinks is the date, and invites you to change it. If a file is loaded, then the date it was last saved is shown. The date is entered just as for date-attribute fields. If you forget to set the date before saving a file, it will characteristically show MF+3's birthday of 01 Jun 87. There is no way to show a file's date on the catalogue - you can only see it by loading it and then using menu 02 [D]. FILE MERGE With normal file load, any previously loaded file is instantly forgotten. But with merge you can take records from a file on disk and insert them into the file already loaded in RAM. For keyed files, incoming data records are inserted into the RAM file in key sequence. For unkeyed files, data records are added onto the end of the file, in the same order as they appear on the incoming file. But you can also use the merge system to transfer format records and LU records. As with all file read operations, you must choose the target file from the disk catalogue, menu 02 [C]. Then use [M] to merge. At this point you will probably be instructed to: Put program disk in A: [Any] This is because the MERGE function needs a program overlay, and if not yet loaded this must be pulled in first. So do what the message says then press a key. Don't worry, you will be given a chance to reinsert the file disk once the overlay gets control: Insert file disk [Any] If the MERGE overlay is already in RAM, these two messages are skipped. Next, menu 03 appears, asking you which parts of the file you wish to merge with the current file: D=all data S=selected data F=formats L=LU records Choose one of these. Probably [D] will be the most likely choice, the others being more esoteric. [S] omits any un-selected records on the incoming file. Menu 03 [D] and [S] merge only data records and ignore incoming formats and LU records. Menu 03 [F] invites you to copy each of the formats, with Y/N response offered for each format found, However, [Y] is treated as [N] if the same format identity is already present in the current file. Menu 03 [F] merges only formats. Menu 03 [L] merges in only LU records, and only those for which no identical key is already present among the current LU records. During the merge process, you can see the record counts clocking up, and on completion main menu 01 is resumed. If the RAM disk fills up before the merge is completed, you will see an appropriate warning message, but then menu 01 is resumed with the file intact with as many complete records merged in as possible. The file will still be perfectly usable. FILE SECURITY Repeatedly saving an updated file onto the same disk, without changing the file name, will usually leave you with the ".BAK" version as emergency back-up in case you find that you had unintentionally erased some vital records. The ".BAK" version is your first (and usually sufficient) remedy for minor mishaps. However, it is sound practice to make an independent back-up of your files every so often, onto a physically separate disk. This insures against such tragedies as accidental erasure, accidental re-format, or physical loss of your normal file disk. How often you make back-ups this way will depend on how often you update the files, how important they are, or how lazy you are. Don't let the last reason dominate, and try not to be one of the many people who find out the importance of back-up the hard way. You can use MF+3 to back-up individual files just by saving them. Or, you may prefer to use a +3 DOS "COPY" command. We have covered data loss. Another security aspect is in a sense the opposite, unauthorized data gain! Forget all the nonsense about passwords, encryption, and hidden directory entries; they are for the most part ego trips for computer programmers, and only get in your way. If you need your data to be private, lock the disks away or carry them home with you, along with the printed reports. LOAD/SAVE ERRORS Some failure messages are encoded "Error code nn [Any]", in which case you must refer to the list below for the precise reason and action. But nearly always you can guess the problem with a bit of common sense Check that there is a disk in the drive. For save/write, check that the disk is unprotected. For save/write, is there enough room on the disk? CODED ERROR MESSAGES The message "Error code nn [Any]" will indicate some error while reading or writing a disk file. These can be interpreted as follows: 01 Failure to open a file for LOAD or MERGE or IMPORT. 03 Failure to read valid control record for LOAD or MERGE; probably because the file is not one saved by MF+3. 05 Read error during LOAD or MERGE or IMPORT. 20 Failure to open disk file for SAVE or EXPORT or PRINT-to-Disk. 21 Not enough room on disk during SAVE or EXPORT, Other error codes should never be seen, e.g. error in reading RAM disk. Call Campbell Systems if such oddities ever occur. Chapter 08: ASCII IMPORT AND EXPORT MF+3 data files cannot usefully be processed directly by any other program, but you can nevertheless convert MF+3 data into an ASCII form which can be read by other programs, such as TASWORD PLUS THREE. Likewise, MF+3 cannot load any foreign file as one of its own data files. But with an MF+3 file already loaded, it is possible to generate additional records from an ASCII file created by another program. We have therefore provided for two-way linkage with other programs, including those which run on any CPC or PCW system. When we wish to package our data to be read by other programs, we EXPORT an ASCII file to disk. When generating records by reading another ASCII source, we call this an IMPORT operation. The term ASCII can be taken to mean "universally readable"; there are a few variations however. For example, some programs like their data to be wrapped inside quotes, some like commas between fields, and so on. Since MF+3 can import and export, it can therefore import data which it has exported. Sounds silly ? Not at all; we can use this process to reorganise a file to a different key, or to add more data names if we have run out of spare names. Export writes data field by field, so that each becomes a "record" on the ASCII disk file. But there is another method called "Print to Disk", which essentially diverts printer output to disk so that your formatted reports can be passed to other programs, rather than the "raw" data. A common use of export is to feed data to a word-processor for mail-merge purposes. A common use of import is to extend a file using data from another program. That was an overview of import/export, so now for some details. EXPORT ASCII TO DISK Apart from Print-to-Disk, all exports are initiated by menu 02 [E]. You must have a file loaded from which the export will be made, and you will want to have ready a formatted disk with enough space to receive the data. The first prompt you will probably see is : Put program disk in A: [Any] This is because a program overlay is needed for import/export. Obey this, and then the overlay takes over and starts to ask a few questions LU records? [Y/N] The usual response will be [N], but press [Y] if you wish to export just the LU records, which are then treated as a two-field file. The next prompt, unless you are exporting LU records, is: A=all data C=chosen data Use [A] to export every field in the same order as in the data name list, or else use [C] if you wish to be selective about the order and about which fields to export. If [C], you are offered the data names screen and selector bar for each field you wish to export. Having chosen the fields, you are asked Data identifiers ? Y/N If [Y], the first field from each record is prefixed with &A, the second with &B, and so on, resuming at &A at the start of each record. These identifiers are necessary when exporting data to systems such as TASWORD data merge. It is not likely to be useful if there are more than 26 fields going out! The next question is : Surname shuffle ? Y/N Reply [Y] if you have made use of surname shuffle codes and wish to export the data as displayed rather than as entered. Otherwise, or if exporting ready to re-import into MF+3, reply [N]. The next prompt asks how to handle line-breaks L/brks: B=blk, C=split other=n/c [B] converts them to spaces, [C] converts them to CR LF codes, any other response leaves them unchanged. Do not use [B] or [C] if exporting in order to re-import into MF+3. (CR=carriage return code 13. LF=line feed code 10) The next question is : Comma delimited Y/N If [Y], any commas in the data are converted to spaces, and then a comma is used to terminate each exported field, which is also enclosed in double-quotes. Otherwise, [N] terminates each exported field with CR and LF. The next question is skipped if you replied [Y] for comma-delimiters : Wrapped in quotes Y/N If [Y], all exported fields (including identifiers if used) are enclosed within double-quote characters, and any embedded double- quotes are converted to single-quote characters. The next question is : Record separators Y/N This is just asking whether or not you want an empty field after each record, perhaps because the receiving program requires it or simply because it looks tidier when loaded by TASWORD. Finally, you are asked for the name of the ASCII file to be written to the disk : Give name of ASCII export file To back out of export altogether, just press [BREAK] which escapes with a harmless error message. Otherwise, give a valid name and then you are given the chance to insert the receiving disk - it must not be write-protected Insert disk to write [Any] Press a key, and then you will be informed "-- Exporting --" and then when completed, "Done [Any]". The disk can now be removed. The file will be complete and terminated with the conventional "soft end of file" character, code 26. Press another key and you are returned to menu 01. Only SELECTED data records partake in the export, so be sure to select all records beforehand if required. If exporting LU records, they all partake since there is no such thing as an unselected LU record. IMPORTING ASCII DATA Before you can import, there must be a file in RAM waiting to receive the data, since IMPORT is treated as a variation of MERGE. Like all disk read operations you must select the incoming file using the disk directory display, menu 02 [C] etc. and then press [I] for import. As with export and merge a program overlay must be brought in so you may see : Put program disk in A: [Any] So change disks if required and press a key. When the overlay gets control you are invited to re-insert the disk containing the import data Insert file disk [Any] Now the import system asks a few questions, starting with How many fields per import rec It is presumed that the data being imported is grouped in some regular fashion, and here you say how many fields per group. The number you give must be no bigger than the number of data names in the current file, since each set of data is used to build a record to be merged. If there are fewer fields than names, in which case the unused data fields will be empty. Now we have some of the same questions as we saw with export . Comma delimited Y/N Wrapped in quotes Y/N Record separators Y/N Reply in the way which you think corresponds to your incoming file. If the file was itself exported using MF+3, then the answers will be the same as you gave when you exported. Then you are informed "- - Importing --" and you may see the record counts clicking up. On completion, menu 01 is presented. The disk may now be removed. Imported data is "topped and tailed" in the same way as data you enter at the keyboard. That is to say, any leading and trailing spaces are dropped. Check the new records, especially to see that the data has kept in step. If not, you have either used the wrong "fields per record" or else responded wrongly to "record separators". If the current file is keyed, the new records created via import are inserted in their correct position. If the file is not keyed, the records are simply appended at the end. The new records are deemed selected. If the RAMdisk fills then the import is curtailed in the same way as with MERGE. If the data being imported is not in fact proper ASCII then the resulting records may look strange when displayed. Also, any embedded code 26 will terminate the import since this character is taken to mean "end of file". RE-KEYING A FILE If having built a file you decide you would like it keyed by a different field, you can convert it using export/import. Consider a keyed file with ten data names, which you wish to key by the fourth name instead of the first name. You would proceed as follows : Select all records then export specifying the fields in the order 04, 02, 03, 01, 05, 06, 07, 08, 09, 10. Reply [N] to all the questions "Data identifiers" to "Record separators", and allow the export to write a temporary file, say "TEMP". Erase all the data records from RAM using menu 01 [SYM D] and [Y]. Import file TEMP and say how many data fields there are (10) and reply [N] to the questions "Comma delimited" etc. Use menu 01 [N] etc to swap data names 01 and 04. Revise all your formats to erase and re-insert all data elements corresponding to the altered data names. File conversion is complete, you may now save and use the file. ADDING MORE DATA NAMES If you wish to add more fields to an existing file, and have exhausted any "(spare)" fields you may have had, then you can proceed as follows. Export all the data. Begin a new file, with more data names. You will have to re-define all the names and attributes, with the new names last. Import the file previously exported. Use the original file to merge in the old formats and any LU records. Revise your formats to make use of the extra data fields - although the records will so far have these fields empty. The file is now ready. PRINT TO DISK An alternative form of export is where the printer output is directed to a disk file instead. Whenever you ask for a print, you are first offered tile choice : Print to: P=printer D=disk Reply [D] and then you are asked for the name of the file to be written; then you are invited to insert the receiving disk. Printer output is then written to the disk, except that prologue printer commands and forms feeds are omitted. The only control codes sent are CR and LF at the end of each line, and code 26 soft end-of- file. finally. Completion is signalled with "Done [Any]". We have not provided for quote-wrap or comma-delimit variations with this form of ASCII output. TASWORD or PROTEXT will be able to read the file directly. Chapter 9: FILE SEARCH We have already seen how to browse through a file in display mode. With larger files the browse method can be cumbersome; so instead one can ask MF+3 to make a logical inspection of the records and pull out just those records of interest for the job in hand. This process is called SEARCH and is initiated either from menu 01 [S]. The result of a search is that the records you Nave found are SELECTED, while the rest are left UNSELECTED. The selected records may then be displayed with relative ease. For example, one can use search to find all the Chopin titles in your music collection, or all addresses containing "London". As we will see, one may even select records on a combination of criteria. The reasons for selecting particular records need not be purely for display convenience. The selected records may be printed, exported, or even saved as a new file. We show may examples of dialogue below. Most are commented with text after a semi-colon. These comments are to help you here, you do not enter them. For example : C ;compare Here, you Just press [C], the rest is just a comment. SEARCH MENU Menu 01 [S] enters Search Mode, producing menu 04 as illustrated below. The examples in this chapter all presume to start with this menu in view. 04: Search Mode Select by compare C Select by set S Select every record E Invert selected status I Assign selected to set A Clear one or more sets Z Show set counts # Describe a set T AZ=az ? YES U Go to display D Go to main menu X SEARCH VIA DATA COMPARE The essential ingredient of a search is usually a comparison of record data with an ARGUMENT. For example, to find all records in which field AMOUNT is greater than 100, one would key: C ;Compare AMOUNT>100 [ENTER] ;Expression D ;Display the selected records Here, the data being examined in each record is AMOUNT, and the argument is 100. The symbol between data name and the argument is the comparison type and must be one of the following : = equal to < less than > greater than <> or >< not equal to >= or =< greater than or equal to <= or => less than or equal to The data name need not be given in full, just enough to be unique, and is not case-specific. In our example, the expression might equally have been abbreviated to am>100 The result of such a search is that the "Sel:xxxx" figure at the bottom of the screen will say how many records have been matched. Indeed, one can see this figure clock up as the search progresses. For numeric data comparisons, the meaning of all six possible comparisons types is self-evident, and is the same as BASIC would interpret them. For character data, there are more subtle rules as follows. a) Whether or not the comparison is case-specific is a choice which you can control via menu 04 [U] option - see below. b) If the argument is shorter than the data in a record, but equal as far as it goes, then data and argument are treated as equal. Thus for character fields the comparison type "=" means "beginning with". c) If data in a record is shorter than the argument, but equal as far as it goes, then the data is treated as lower than the argument. Where the target data has a DATE attribute, then the argument must be keyed as usual, i.e. ddmmmyy. But the search process makes the comparison in internal date format. Thus to find all records where Date is later than June 1987, one would use C Date> 30june87 A most powerful search function is STRING SCAN. This allows any letter, word, or phrase to be sought within data. The way to specify a scan is to place the data name in brackets. For example, to find records where Address contains the word "London", we would use C (address) = London The comparison type of UNEQUAL may also be used. For example, to find records where Address does NOT contain the word "London" C (address) <> London All comparison types except "=" are in fact treated as UNEQUAL where string scan is used. A variation of string scan Is GLOBAL SCAN. This is the same kind of hunt except this time every field in a record is examined for a match. Global scan is indicated by using an asterisk instead of a data name. Thus to find all records containing the word "compute", irrespective of data name : C (*)=compute In the case of global search, the brackets are not necessary and one may more simply key C *=compute String scans are also capable of finding words in DATE fields, or digits in numeric fields. For example, to find all "January" dates one may key : C (Date)=jan One more kind of criterion expression remains; this is where no argument is given, and provides the means of selecting records on the basis of whether or not a particular field has any data in it. We may use expressions data name = ;i.e. present data name < > ;i.e. absent Thus to find all records where there is no Telephone Number C Tel <> SEARCH ON RECORD NUMBER Record numbers are not stored in the file, but are computed in flight. Even so, it is possible to search by record number, using the "%" notation as in the following example C % < 100 This means "select the first 99 records". In other words, think of data name as referring to the record number. CASE-SPECIFIC TOGGLE Menu 04 [U] will change the case-specific state, so that in one state upper-case letters are treated the same as lower-case, while in the other state (case-specific) the lower-case letters are all "higher" than "Z". The menu itself indicates the current setting. SELECT EVERY RECORD Menu 04 [E] causes all records to become selected. This option is also available directly from the menu 01. INVERT SELECTED STATUS Menu 04 [I] provides a quick way to select all unselected records, and to un-select all selected records. SETS AND COMBINATION SEARCHES Search by compare [C] always resets the "Sel:xxxx" count on commencement. This seems to give us no means of searching on several criteria - e.g. how can we select all records containing "London" and/or with an account marked "unpaid" ? The answer is provided by the SET markers, explained next . . . . ASSIGN SELECTED RECORDS TO A SET Every record has eight SET markers, which we refer to simply as sets 1-8. We can assign currently selected records to any of the seven sets, using search menu 04 [A], which yields the prompt Assign to set 1-8 Suppose for example, we have Just selected 10 records containing "London"; we can assign them to set number 1 as follows - Al ;assign to set 1 Now we can select "unpaid" - perhaps we find 8 of them; then assign them to set number 2 as follows A2 ;assign to set 2 You can also assign individual records to a set when in display mode; see Chapter 6. DISPLAY SET COUNTS We can display the number of records in each set using menu 04 [L], and if we do so now we would see they include Set 1: 10 Set 2: 8 It is important to note that sets of records can overlap. In other words, records in this example which contain both "London" and "unpaid" will be present in both sets 1 and 2. Set assignment is always Cumulative. This means that when records are assigned to a set, any records already in the same set are not affected. Thus for example, if we start with all set counts at zero, we can first search the "London" records, assign to set 3, then search "Bristol" records and assign also to set 3. The result is that set 3 contains all records which are "London" or "Bristol". Not only are the set counts displayed, so are there descriptions. These descriptions are put in automatically by assign [A] or manually via [T]. Once the counts have been displayed, you can re- display them via side-scroll since menu 04 will respond to [>] and [<] SELECT BY SET Now we can see how a combination of search criteria can be handled. Having marked our records using sets, we now use menu 04 [S]. Here, the set markers themselves determine which records are selected. One can select records on the basis of being in a particular set, or in several sets, or in at least one of several sets; or on the basis of not being a member of one or more sets. Menu 04 [S] yields the prompt : Sets: A=all N=none S=some On pressing one of the indicated keys you are then asked : Give sets 1-8, and + if cum. Here you key one or more digits 1-8, in any order, and then [ENTER]. The result is that MF+3 will select the combination of records you have specified. Starting at menu 04, possible replies in respect of our example would be SA1 [ENTER] ;"London" records SA2 [ENTER] ;"unpaid" records SS12 [ENTER] ;"London" records and/or "unpaid" records SA12 [ENTER] ;records with both "London" and "Unpaid" SN1 [ENTER] ;All records except "London" SN2 [ENTER] ;All records except "Unpaid" SN12 [ENTER] ;All records except "London" or "Unpaid" If only digits 1-8 are given, then any records which are already selected are un-selected in flight before the sets are compared. But we may wish to leave those records already selected, so that the action is cumulative. This is where the use of "+" is to be used, and it can be anywhere in the reply. For example, another way of selecting all set 1 and 2 could be : SA1 [ENTER] SA+2 [ENTER] Students of SET theory will by now recognise that a Venn diagram will be helpful for complex combinations, and that some combinations can be reached by more than one method. CLEAR SETS TO ZERO Since all set assignments are cumulative, we need a way to clear them down again. This is done using menu 04 [Z], which yields the prompt : Enter one or more set numbers 1-8 Reply with any number of digits 1-8, in any order. All sets so specified are cleared in all records. SET DESCRIPTIONS Each of the eight sets can be given a description, which is even preserved when the file is saved. When a set is assigned, the default description is the last entered Data Compare expression. But you may store any text you like in its place, using menu 04 [T]. This yields the prompt Describe set 1-8 Reply by pressing a numeric key to indicate which set, then you are asked Give set description Now you may enter any description up to 25 characters. EXIT SEARCH MODE There are two exits from search mode; [X] to the main menu 01, and [D] to display mode. MORE ABOUT SETS We have described set markers as a means of performing combination searches. But you can use one or more set markers for other purposes, perhaps to monitor critical records. Display mode offers you the chance to set or cancel the set flags on an individual record basis. You might reserve 1-4 for temporary combination search use, and 5-8 for semi-permanent ad hoc markers. Set markers are not affected by save load or merge. Chapter 10: TABLE LOOK--UP Table look-up allows stored codes in your data records to be translated into longer pieces of text for display and print purposes. The data records themselves are left in coded form. File system therefore is primarily aimed at saving space and keying effort. LOOK-UP RECORDS These are optional records stored as part of the main file, which allow the data records to retrieve text on a look-up basis. We use the abbreviation "LU" to mean "Look-up". Each LU record consists of a short KEY and a line of TEXT. Consider by way of example a Bought Ledger file where each data record contains translation date, supplier, expense code, goods, and amount. The expense code might be a two-digit value with the following values : 01 Advertising 02 Direct Materials cost 03 Salaries and NI contributions 04 Office lease etc This list can be entered as LU records, so the first LU record would have a key of "01" and text of "Advertising". Then we can devise a format which shows tile full expense description against each Bought Ledger record. The main use of LU records is to save on file space, and on your time when entering the data. But there are more subtle advantages - such as validation of the keys since any invalid would fail to retrieve any text. LU FILE MAINTENANCE To create and maintain LU records, start with menu 01 [L]. This may invite you to insert the program disk from which an overlay is loaded. Once loaded, menu 14 is offered. This operates a bit like display mode, with the target record being indicated by a white bar cursor. [I] inserts a new LU record, and asks for a key of up to ten - characters, then text up to 85 characters. Duplicate keys are forbidden. You cannot alter a key, instead you erase that entry and raise a new entry. [EDIT] Permits alteration of the text of the target LU record. [UP] and [DOWN] identify the target LU record. [F] is a direct way to move to a target record, using the LU key as search argument. This is more useful where the LU list is large. [E] erases the target LU record [P] lists the LU records to the printer. No printer options are offered, but if you wish to print them in a particular style you can make use of the printer settings from a previous display print. [<] and [>] operate the side-scroll. We suggest you use short LU keys, ideally 1-3 characters although up to 10 are permitted. The text can be 1-85 characters long. Do not enter line-break characters or shuffle characters since LU text behaves like a heading and is not processed the same clever way as data text. You can have more than one set of LU records, provided all LU keys are unique, since the system will regard them as just one LU set. For example, in the Bought Ledger example we might choose to use supplier codes as well as expense codes, perhaps using an alphabetic abbreviation: APS Acme Packaging supplies GI Global industries MP Micro Publications etc HOW TO RETRIEVE LU TEXT In format mode create a heading of the form "%Lnn" where nn is the data number of the field which contains the LU key. For example, if in the Bought Ledger example the expense code is data number 03, the format heading will be "%L03". Position it where you wish the looked-up text to start. If the %Lnn heading is placed in the data zone, it will behave like a data zone heading except that it will vary from record to record, varying as the LU key found in field nn varies. If a LU key is not matched, or if it is absent, the legend "---" will appear in lieu of the LU text. If the LU heading is placed above the data zone, then it retrieves text in the same way except that it also forces a change of screen upon change of LU key where several records are selected. Clearly any headings above the data zone apply to all records shown in that page, so a change of heading must require a change of page, both on screen and on paper. it therefore follows that it is normal to use such a format only where the selected records are sorted by LU key, otherwise the display will be unduly fragmented into short pages. MERGE/EXPORT LU DATA It is possible to transfer one file's LU records into another file, and this is described in the section FILE MERGE in Chapter 7. It is also possible to export in ASCII form the LU keys and text as if they were a two-name data file, ready for processing by such programs as TASWORD PLUS THREE. See Chapter 8. Chapter 11: FIELD CALCULATION Within a record, numeric data can be computed and stored under the control of a FORMULA. Formulae are keyed as headings in a format, and are visible only in format mode; they are invisible in display mode. An example of a formula is [4] = ( [10] + [03] ) / 2 This formula means Calculate the field whose data number is 4, to be field 10 plus field 3, all divided by the absolute number 2. A number in square brackets is a data number, hence such terms refer to data (usually numeric) within a record. It does not matter whether the data attribute of such fields is numeric or character. A number not in square brackets is a literal value. The term to the left of the equals sign must always be referring to any field except the key. This is the computed field, and if it already exists when the calculation is made, the result replaces the previous value. To the right of the equals sign, you may have any arithmetic expression made up of numbers, operators, data terms in square brackets, and round brackets. Further examples are : [22]=[22]*2 [10]=1000 [4]=200-[3] [20] = ( [2]+[3]-[15] ) / ( [6] + 100) Valid operators are plus, minus, times, divide and except where round brackets dictate otherwise, * and / are executed before + and - in an equation. Other special operators are allowed, which we will discuss later. Spaces between terms are optional and have no effect. The result of the calculation is always rounded to two decimal places before storing. Negative results have a leading minus sign. The length of a formula is limited to 96 characters. There can be any number of formulae. A formula is keyed as a heading beginning with the character "[" Notice that "[" is keyed using [SYM Y], and "]" is keyed using [SYM U]. HOW TO CALCULATE Calculation is done on demand; it is not automatic. The calculation logic requires a program overlay and so you may be prompted to insert a program disk when required. Menu 01 [C] causes all formulae in the CURRENT format to be applied to all SELECTED records. However, any error - such as data number out of range, or zero-divide overflow - will halt the calculation and display the record at which the error occurred. The order of execution of multiple formulae is the order they are stored in the format, as seen via menu 08 [S] [N] [N] etc. Progress is shown as a count: -- Calculating: record xxxx -- Alternatively, in display mode an individual target record can be calculated using display mode [C] as long as a field cursor is showing and sort is not operative. It is possible to have two or more different sets of formulae by using several formats to store them. Only the formulae in the current format are used. If there are no formulae in the current format, the program warns you if you use menu 01 [C]. FILE FULL Calculations - especially first time through - usually change the length of the records they process. This in turn can rapidly fill up the RAM disk, especially if the file is already larger than 32K. For large files, it is quite possible that menu 01 [C] can abort half way through due to "FILE FULL". Menu 01 [R] will reclaim the RAMdisk space, and then [C.] can be used again. Those records already processed will probably not change in length next time through, so calculation will progress further. However, beware re-calculation if you are using a formula which calculates one of its own terms ! e.g. suppose you wish to update all your stock prices by 10%, your formula might be : [8] = [8] * 1.1 If this formula is used twice in the same records, the result will be a 21% increase. The way to avoid this kind of problem in large files is to select and calculate one section of the file at a time. CHAINED FORMULAE It is possible to use the result of one formula in another. Hence for example to generate the Nett [04] and VAT [05] from Gross [03] one can use two formulae: [04]=[03]/1.15 [05]=[04]-[03] (This example assumes a VAT rate of 15%) Note that it is not the order of formulae shown on the static format screen which governs the sequence of calculation, but the order in which the elements appear via menu 06 [S] [N] etc. CONDITIONAL TERMS Special operators are used to generate true/false values of 1 or 0 respectively. These operators are < Less than <= Less than or equal to = Equal to <> Unequal to >= Greater than or equal to > Greater than For example, consider the following formula [6] = ( [5] > 1000 ) * [04] If field 05 is more than 1000 then "[05]]>1000" takes the value of 1, otherwise it takes the value of 0. Hence field 06 becomes set to the same value of field 04 as long as field 5 is more than 1000, otherwise it is set to 0. Here is another example : we want field [4] to be set to whichever is the greater of fields [2] and [3]. Conditional terms come to the rescue [4] = [2] * ( [2] >= [3] ) + [3] * ( [2] < [3] ) NON-NUMERIC DATA Any non-numeric data yields the value of zero for the purpose of calculations. Likewise, data absent from a record will be deemed to take the value zero, regardless of any default text in the format. Thus zero-divide overflow is likely to be your most frequent cause of error. Beware that any leading letter or symbol will render the value of a field to be zero for the purpose of calculation, even though the display may show otherwise. For example, a field with numeric attribute and containing "A20" or "œ20" will display as "20.00", but it will be taken as "0" by the calculation. Note that it is all right to specify a leading currency symbol in the format attribute - this has no effect on the calculation and is the preferred way of displaying currency. GROUP FIELD ERASURE A special formula can be used to erase a field entirely from all selected records; this simply uses a "D" to the right of the equals sign. For example, a formula to clear all data number 05 is : [5]=D MISCELLANY There is no way to carry forward the result of a calculation in one record into another. Therefore cumulative running totals are not possible. Chapter 12-. OLD MASTERFILE FILE CONVERSION The original Spectrum MASTERFILE (version 01 to 09) saved its files as character arrays, and has no export option. Such arrays are not suitable for direct import into MF+3, so we have provided a utility called CONV which will process these files and produce ASCII data files which can then be imported into MF+3. The conversion of an old Spectrum MF file is as follows a) Save F$ character array to disk, as follows : In 48K BASIC, use old MASTERFILE to save file-only to cassette. Then in +3 BASIC : LOAD "T:filename" DATA f$(): SAVE"A:filename" DATA f$() b) Use program CONV to generate an ASCII file from this. c) Import the ASCII file into MASTERFILE 3 Program CONV will ask for input and output file names. It will also ask for a list of data references. The order of this list determines the order of data in each output record. Enter the data references one after the other with no opening quotes, no spaces or commas, and end the list with [ENTER]. Any data reference not found creates a null item on the ASCII file. You can make use of this where the new file has data names which do not correspond with the old file, by just keying a "." for absent references. For example, if the old file has references N,A,T but the new file requires these fields as the 1st, 2nd, and 6th fields, just give a data reference list of: NA ... T Any line-break characters found in the data will be converted from "|" to "_" On completion, the record count is shown and another file conversion is prompted. To end, just reset the machine. Data names and display formats are not transferable. The whole character array F$ file is read in before the output file name is solicited, giving you the chance to change disks for the output file. The input file is validated and any file which does not look like a old MASTERFILE file is not accepted. To transfer the output of CONV into an MF+3 file, first use MF+3 to initialise a new file with suitable structure, or load an existing file. Take care that the data names correspond with the data references specified to CONV. Then use the IMPORT function of MF+3. Reply [N] to each of the questions about quote-wrap, comma- delimiters, and record separators. Once you have successfully imported the CONV output and saved the resulting MF+3 file, there is no need to keep the intermediate file. Chapter 13: PROGRAM CUSTOMISATION AND FIXES Program "FIX" has been provided to enable you to customise MF+3, and also to make any emergency corrections which you think may be required. To run the utility start the machine, place your un-protected MF+3 program disk in the drive, go into "+3 BASIC" and LOAD "FIX". You should see the following MASTERFILE MF+3 Fix Utility --------------------------- Un-protect your program disk Give 2-char suffix: You reply with a number such as "01", as described for the particular fix. Then you are asked : Give 4-char hex address Again, you reply according to the particular fix or customisation. Then: Give hex patch string Reply according to the particular fix, using an even number of characters in the range 0123456789ABCDEF. If this looks right you are invited to : Press Y to confirm [Y] confirms the fix and writes it to the program disk. Any other reply backs out. Then the first prompt is offered again. If there are no more fixes to apply just press [ENTER] which acknowledges with : No more fixes, press RESET Remove the program disk, protect it, and reset the computer. UK POUND-SIGN The character "œ" suffers an identity crisis in that there is no dedicated ASCII code for it. For most matrix printers with "UK" language set, code 35 usurps the "#" symbol and prints the "œ" symbol in its place. It follows that "œ" and "#" both print as "œ" for UK, or both as "#" for USA etc. Therefore you must make use of the Printer Options Panel ( Menu 08 [P], see Chapter 5. ) and choose the language accordingly. MF+3 cannot print both "#" and "œ" in the same report, unless your printer accepts a different code for "œ". In fact, the Spectrum computers represent "œ" internally as code 96, so MF+3 translates this code in flight to 35 when printing. Export and print-to-disk do NOT translate. This can be fun when exporting data to a CPC computer, since this uses code 165 for its internal sterling symbol. If your printer uses a code other than 35 for the sterling symbol, then you can patch a different value as described in the next page. CUSTOMISE OPTIONS Use FIX as just described, and for every custom patch the 2-char suffix to give is "01". We will just describe the 4-char hex address and comment on what values to apply. It will be helpful to be acquainted with hexadecimal notation. Do not alter your original MF+3 program disk - keep it protected at all times. Fix or customise only your working copy. Keep notes of all fixes applied. Hex address Comments 8882 Table of month names, "JanFeb...Dec". To alter these you must enter 72 hex characters. e.g. for "JANFEB" etc the patch will be 4A414E464542 etc 88A6 Shuffle character, currently hex 3C for "<". Enter suitable code here in hex. 88A7 Line-break character, currently hex 5F for "_". Enter suitable code here in hex. 88A8 Export data identifier prefix, currently 26 for "&". Alter to taste in hex 88B1 Spectrum colour attribute for all menus and prompts. This is currently hex 70, but alter to taste. Suggested values are: 78 for bright white 38 for dull 70 for bright yellow 30 for dull 68 for bright cyan 28 for dull 60 for bright green 20 for dull 5F for bright magenta 1F for dull 57 for bright red 17 for dull 4F for blue 47 for black 88B2 Colour of line 20 menu headings - currently hex 70, but you may wish to alter to contrast with the text of the menu 88B3 Default background and border colour, currently hex 38. Dark colours not recommended since field cursor loses contrast. 8934 Printer code for sterling symbol (œ). Normally hex 23 which is decimal code 35. Chapter 14: GLOSSARY The following is a list a terms which you may find useful. Some of these are dictionary definitions some are common parlance in computing, and a few are specific to the context of MF+3. ASCII American Standard Code for Information Interchange. A commonly used way of encoding characters one per byte. ARGUMENT Something with which records are compared during a search. ATTRIBUTE Type of data, namely character, numeric, or date. BACK-OUT To abandon What you have started, normally via [BREAK]. BACK-UP Spare copy of a file in case of loss - making this. BAK (.BAK) File suffix of previous version of a re-saved file. BOX A rectangular frame to embellish your display. BREAK The key which by convention we use as a panic button. BROWSING In display mode, viewing several pages of data. BUFFER Temporary storage for data awaiting read/write. BYTE Unit of RAM, storage for one character normally. CARRIAGE RETURN ASCII code 13 which tells a printer to return its print head to the left-most position. Some device. take it as line feed too! CASE-SPECIFIC Where for example "Fred" is not regarded as being the same as "FRED". CATALOGUE List of files held on one side of a disk. CENTRALISE To display a field in the centre of its allocated field. COLUMN TOTAL The arithmetic total of a field from all selected records, displayed after the last selected record. Column totals are not stored anywhere but are computed in flight. COMBINATION SEARCH Selecting records on the basis of two or more properties. CONDENSED Print face style spread at approx 17 CPI CURSOR A small rectangle on the screen to show where typed text will appear. DATA COMPARE In search mode, selecting records by comparing their data with an argument. DATA IDENTIFIER Optional two-character prefix to expor ted data. DATA NAME A name or short description which you give to each data field you wish to store in your file. DATA NUMBER A number 01-60 allocated to each data name. This number is then used as a short hand way of referring to a data. DATA ZONE One or more screen lines within which a format can present data from one record. The depth of the data zone determines how many records per screen can be shown. DEFAULT TEXT Text to be shown where data is absent. DISK DIRECTORY List of files held on a floppy disk. DISK Abbreviation for "diskette" DISPLAY MODE Where records are displayed and can be altered. ELITE Print face of approx 12 Cpi ERASE DATA Removing a field from a record. ERASE RECORD Remove an entire record, decreasing the "Recs:xxxx" count. ESCAPE CODE ASCII code 27 which tells a printer that a special code is coming next EXPORT Create an ASCII file from MF+3 data which may be read by another program. FIELD Unit of data in a record FIELD CURSOR Highlighted block indicating which field and record you are addressing. FILE Collection of records, data names and formats, stored on a disk. FILENAME & FILETYPE Identification of a file on disk. FORMAT Style of display; instruction for saying what is to be displayed and where. FORMAT ELEMENT Part of a format specification, e.g. field, heading, box, panel. FORMAT IDENTIFIER Character "0" to "9" identifying a format. FORMAT MODE Where formats are created and altered. FORMAT ZERO The initial system-generated format FORM FEED ASCII code 12 - tells the printer to start a fresh page. FORMS DEPTH The number of printer lines from one perforation to the next. GLOBAL SCAN In search mode, selecting on the basis of a character string occurring anywhere in a record, regardless of which field. HEADINGS Displayed text taken from the format rather than from your data records. IMPORT Build new records from an ASCII file. INVERT Make selected records un-selected and vice versa INTERLEAVE Where printed output combines two formats for each record. JUSTIFY To bias the placement of data within its allocated area. K The quantity of 1024 of something. 1K of RAMdisk can therefore hold 1024 characters. KEY a) The keyboard buttons, or the action of using them. b) First field of a keyed file c) Data name of b) KEYED (FILE) Where the contents of the first field in a record determines its position in the file. LEADING SYMBOL For numeric-attribute data only, an optional character e.g. "œ" displayed in front of a field. LEFT MARGIN How many characters to displace printed output to the right. LINE-BREAK CHARACTER A special character "-" used in a fiel d to force a change of line where room. LINE FEED ASCII code 10 which tells a printer to advance one line. LOAD The transfer of an MF+3 data file from disk to RAM. LOOK-UP FILE Set in LU record from which text can be retrieved for display. LU Look-up MAIN MENU Menu 01, the central control point f MF+3 MENU A list of choices from which you choose by pressing a key. MERGE The process of extending a file by appending or interleaving record from another file. NUMERIC ATTRIBUTE Of a field which merits numeric displa y treatment. PAGE NUMBERING Printed page numbers effected by a heading "%PG". PANEL A coloured rectangle on the screen. PARTIAL SAVE Save where un-selected records are omitted. PICA Print face style at 10CPI PROMPT A message in line 20 inviting you to do something. RAMDISK An area of computer memory, which behaves like a disk drive, at many times the speed. RECLAIMABLE Space in RAMdisk which will be made free by REORG. RECORD NUMBER The position of a record in the file. You can display this using a heading element "%RN". RECORD A group of associated fields of data. REORGANISE Reclaim "dead" space on the RAMdisk. RESERVED DATA NAME One beginning with "(". RS232 Approximate standard of serial (one bit t a time) data transfer. SAVE The process of replacing an MF+3 data file on real disk. SEARCH To select records on the basis of their contents. SELECTED Describing those records which can be displayed, printed, exported. SET One of eight logical categories any combination of which you can assign to a record. SET COUNTS A display in search mode, showing how many records are members of each of the eight sets. SET DESCRIPTION Up to 25 characters of text describing a set. SHUFFLE CHARACTER A special character which causes displ ay mode to present data so that what foll ows the shuffle character comes first. SIDE-SCROLL Shift of the window across the virtual screen via [<] and [>] SORT A file manipulation which allows records to be presented in a sequence different to that dictatedby their key. STRING SCAN Selecting records based on a character string being found anywhere within a field. SEE also Global Scan. SURNAME SHUFFLE Describes what happens when shuffle character is used TARGET RECORD The only record in the screen, or else the record where the field cursor is present. TEXT EDITOR The part of MF+3 which allows you to key or alter text THOUSANDS COMMAS Optional numeric presentation as in "2,000,000" TOGGLE Turn OFF if ON, or ON if OFF, like a bathroom light switch UNKEYED Of a file where records can be inserted at any point. UNSELECTED Describing those records which cannot be displayed etc. at the moment. VIRTUAL SCREEN MF+3 display area 20 lines deep, 96 columns wide. WORD-WRAP Where a fresh line is started in order not to break a word into two pieces.