                                  MASTERFILE VERSION 09                                 BUSINESS/DOMESTIC                                   FILING SYSTEM                                FOR 48K ZX SPECTRUM                                    CLEAR 57327                                     LOAD 'MF'                                 Edition 11-May-85                                      CONTENTS         Chapter                                                     page         GLOSSARY OF TERMS ..................
...........................2         OVERVIEW.......................................................4         FILE STRUCTURE.................................................5         PLANNING A FILE................................................6         MENUS,PROMPTS,MODE.............................................7         BASIC COMMAND MODE.............................................8         GETTING STARTED................................................8         MAIN MENU OPTIONS....................
..........................9         EMPTY FILE....................................................10         DATA NAMES....................................................10         EDIT MODE.....................................................10         MICRO-PRINT...................................................13         WORD PROCESSING...............................................14         ADD A RECORD MODE.............................................14         DISPLAY MODE..........................
........................15         UPDATE MODE...................................................16         EXERCISE......................................................17         SEARCH MODE...................................................19         TOTAL/AVERAGE.................................................21         LOAD AND SAVE.................................................21         STATISTICS....................................................22         USER BASIC.............................
.......................23         MICRODRIVE....................................................25         SOME POKES....................................................26         OUTPUT TO NON-ZX PRINTERS.....................................26         MASTERFILE 09 ENHANCEMENTS....................................27         COPYRIGHT NOTICE..............................................27                                         1                                                                 GLOSSARY OF TE
RMS                                ADD                Insert a new record onto the end of file              ARGUMENT           In search mode, something with which records                              are to be compared.                                   AUTO-PROMT         Where new data items are solicited automati-                             cally                                                 BACK OUT           Change one's mind                                     COMMAND MODE       Where cursor is fla
shing K and awaits line                               number or Basic keyword                               DATA NAME          Legend associated with a data reference               DATA REFERENCE     Letter A-Z by which data items are identified         DISPLAY MODE       Where selected records are viewed in a report         EDIT MODE          Where report formats are created/altered              EMPTY FILE         One devoid of records, data names, report                                formats             
                                  FILE               Collection of records, and associated data                               names and report formats                              GENERAL            Overall attributes of a report                       INVERT             Flip select status of all records                    ITEM               Data, 1-128 characters in length                      LITERAL TEXT       Static text, e.g. a heading, in a report              MAIN MENU          The menu offered when t
he program is loaded           MENU               List of key options                                   MICRO-PRINT        Compression of displayed text on the screen           MM                 Abbreviation for main menu                            NULL TEXT          Legend shown in a report in the absence of                               an item                                               PAD                Fill out data with spaces in a report                 PROMPT             Instruction to the user,
 or small menu                PURGE              Erase all selected records                            RAM                Random access memory available for operatings                            the program                                           RECORD             Collection of up to 26 items, each with a                                different data reference                                                              2                                         REPORT             Display of selected rec
ords                           REPORT ELEMENT     A part of a report, e.g. heading, box,data                               spec.                                                 REPORT REFERENCE   Character 0-9, A-Z identifying a report               RESET              Clear select status off all records                   SEARCH MODE        Where records are selected or otherwise by                               comparing with an argument                            SELECTED           Eligible for display in 
a report                      SEQUENCE           Where records are listed in ascending order                              by one item                                           UPDATE MODE        Where a record can be altered                         USER BASIC         Basic which you can supply for special                                   processing                                                                            3                                                                     OVERVIEW      
                               MASTERFILE is a filing and retrieval system for use with the 48K         ZX Spectrum. It is almost entirely machinecoded for compactness         and speed, and offers about 32K of data per file. Files  can  be         saved and loaded independently from the program, and stored         either on cassette or Microdrive cartridge. Because MASTERFILE         display formats are user-defined, the range of applications is         enormous, both for domestic use and for business. Add
ress lists,         library catalogues, personnel files, stock  inventories,  school         exam  results, familytrees - all these  are  easily  handled  by         MASTERFILE.         Some of main features of the program are:                                 -Menu-driven                                                             -Dynamic variable-length file                                            -User-defined data names and report formats                              -Sequence by any data type       
                                        -File search by any number of criteria                                   -Display 1-22 records per screen                                         -Micro-print feature for up to 51 characters per line                    -Print to the ZX Printer                                                 -Print to other printers via suitable interface                          -Total/average                                                           -Update, copy, erase any record   
                                        -Save load files, save program                                           -Optional User Basic interface                                           -Microdrive compatible                                                   -Speed of operation                                                                                     4                                                                  FILE STRUCTURE                                  A file is an organised collection
 of data  which  is  stored  on         cassette  or  cartridge,  and  which  can  be  loaded  into  RAM         for enquiry  or  update  purposes.  It  may  be  simple  like  a         telephone list, or complex like a personal  data  file.  But  in         every case, a file is made up  of  records,  each  of  which  is         usually related to a particular identifying item e.g. a person,          a recipe, a part number. Each MASTERFILE record is in turn made up         of up to 26 different items of d
ata e.g. name address, telephone         number, stock level. Data items are all treated by MASTERFILE as         being of variable length, up to 128 characters long. There is no         rigid record structure, and items can be  stored  in  any  order         within a record; for this reason items are tagged  with  a  data         reference letter. A record cannot have more than one of any data         reference: this is an important limitation to bear in mind  when         designing the structure of your f
ile.  All  data  is  stored  in         character format.                                                        One of the many advantages of a computer file over a card  index         system is that you can sort it into any order.  MASTERFILE  does         not actually sort your file, but instead lets you view it in any         sequence you choose. Any you can have different logical views of         the same data in different  sequences, a feature  normally  seen         only in large computer systems. Fu
rther, you  can  be  selective         about which  items  are  required  in  a  report, and choose the         display style. You will compose a report format for each view of         the file which you need. Once the formats are built,  they   are         saved automatically as part of the file.         While items are referred to using a  single  letter  ,  you  can         associate a word or phrase with  each  reference  letter,  which         MASTERFILE then  displays  whenever  you  use  data  refere
nces.         (Especially in  AUTO-PROMPT, q.v.) We call these data names, and         these names are also stored automatically as part of your file.                                          5                                                                  PLANNING A FILE         We do recommend  that you  work  through  the  section  entitled         'EXERCISE' before starting your own file. After that we  suggest         the following approach.         The most important task is to decide what data  is
  to  go  into         each record. Allocate a letter  A-Z  to each kind  of  data  you         wish to store. Try to estimate the average  record  size,  using         the formula  1+N+D , where  N    is  the  number  of  items  per         record, and  D  is the average number of keystrokes of data  per         record. Then divide this  into    32000    for  the  approximate         maximum number of records. Also allow a few dozen bytes for each         display format which you will compose.         Reme
mber that while any item can be present or not in a  record,         you cannot have more than one item of the same data reference in         one record. If your file does require multiple items  associated         with a given person, then you must either have multiple  records         (which wastes file space), or allocate a range of different data         references-which can complicate file searching.         The next step is to allocate a name or description for each data         reference. Do this as 
described in  DATA NAMES  , after creating         an empty file-see  EMPTY FILE.         Next, add just a few records-see  ADD A RECORD MODE.                     Now comes the hard work, where you must design and  specify  the         way you want to view your file. Remember that you can have  many         different  views,  different  sequences,   different    formats,         different contents. Start with a simple format-it may be helpful         to plan it on paper first. Leave embellishment such as li
nes and         boxes until last, after you have 'frozen' the positions of  your         data and headings. Give  special  attention  to  the  'interval'         which affects the spacing between displayed records.  See  EDIT         MODE, MICRO-PRINT  and  WORD PROCESSING.         Once you are satisfied with your report format(s), and your data         organisation, you are ready to build your file. Do  remember  to         take a file save from time to time.                                         6      
                                                         MENUS, PROMPTS, MODES         MASTERFILE  menus  are  yellow  and  respond  to  upper-case  or         lower-case keys  impartially.  When  MASTERFILE  is  loaded,  it         presents the  Main Menu (MM). The screen also displays the  file         name (up to 10 characters) and the MASTERFILE version number.         When a key corresponding to one of the options on  the  menu  is         used,  MASTERFILE  either  takes  the  indicated   action,    
or         immediately offers another menu or prompt. A  prompt  is  a  one         line instruction or menu in the lower part  of the  screen,  and         takes priority over any other menu. All  the  yellow  menus  and         prompts  respond to just  a single  key.  But  where  MASTERFILE         requires a textual response, the flashing  L  cursor appears and         you terminate your response with the  ENTER  key.         MASTERFILE  nearly always offers a menu or prompt, but there  is         one e
xeption: when in  DISPLAY mode the  menu  would  obliterate         your display, so it not usually shown. But you can overlay  your         display with menu by using the  Q key  - and use    Q  again  to         remove the menu.         MASTERFILE operates in a variety of modes, usually  shown  by  a         blue heading. (But not  DISPLAY mode-we leave lines 0-21 to you.         DISPLAY mode always shows  Report n  in red  on  line  22.)  The         important modes are described in the glossary, and  so
me  modes-         SEARCH ,DISPLAY, MM- are accessible by several menu routes.         It would be a little dangerous to allow a single-key response to         erase data, so MASTERFILE always asks for confirmation  via  the         Y  key. Likewise, User Basic is potentially drastic,  and  again         requires  Y  to confirm. If you see Y to confirm  you  can  back         out with any key exept  Y.                                         7                                                                
BASIC COMMAND MODE         With a few exeptions, MASTERFILE runs under machine code control         and the  BREAK  key is inneffective. But if you  need  to  adapt         the Basic (e.g. for Microdrive) or if you need to  put  in  your         own User Basic, then you must get into  COMMAND mode.  This  can         be done only when  MASTERFILE offers a flashing  L  cursor, e.g.         press  L  at MM. If you then respond with  CAPS SHIFT held  down         and 6, you get  H STOP in INPUT  etc and now yo
u are in  COMMAND         mode and can list and alter the Basic.         To resume MASTERFILE processing, give the command  GOTO 1, which         takes you to the main menu again. GOTO 1  should also be used to         recover any accidental drop into  COMMAND  mode. Do not    CLEAR         or  RUN  ,since these will cause MASTERFILE to fail.                                  GETTING STARTED         Your    MASTERFILE    cassette    contains    two      identical         recordings-either consecutive, or one
 each side. Each  recording         is in two parts:          (a) Program: MF          (b) Bytes:   MF mcode         Part (a) is in Basic, and  includes  the  example  file.  Before         loading MASTERFILE Basic, remember this first vital step:           CLEAR 57327  (57036)  (or  whatever  number  is  indicated  on         cassette label)         Now you can load the program, using           LOAD "" or LOAD "MF"         Once loaded it automatically loads part(b) which is about 8K  of         machine cod
ed MASTERFILE logic. Just leave the cassette  playing         until MM appears.         The reason for the CLEAR nnnnn is to reserve the top of part  of         RAM for the MASTERFILE machine code. We cannot put  the    CLEAR         into the MASTERFILE Basic, because that would  erase  MASTERFILE         key  variables,  including    F$    which  contains  the   file.         MASTERFILE will not work if any other interface software has  to         use RAM above the  CLEAR  address.                         
                8                                                                 MAIN MENU OPTIONS         The main menu represents the top of logical level of processing          and offers functions which affect the  file  as  a  whole.  Some         functions are described more fully elsewhere in this manual.         A  Add a new record onto the end of the file. A  one-byte record            is inserted and you can see the Recs=and  Sel=counts            increment.   See ADD A RECORD MODE, q.v.        
 C  Lists all report  references,  together with top-most heading            of each report. You can switch to DISPLAY  mode  by  pressing            the report reference of your choice, or  you  can  use  ENTER            to return to MM.         D  Switch to DISPLAY mode to view selected records. The   report            format used will be either the firs one created, or the last            one used. If there are no report formats yet, EDIT mode is            entered.    Several other menus offers a  D  o
ption. See            DISPLAY MODE.         E  Switch to  EDIT  mode to review  or  update  report  formats.            See  EDIT MODE.         L  Load a file which has been saved via MM  V,F  etc. See LOAD            and SAVE.         N  Review or update names. See  DATA NAMES.         S  Switch to  SEARCH  mode to identify records according  to the            values of data they contain. See  SEARCH MODE.         I  Invert the  SELECT  status of every record. Selected  records            will become unsel
ected, and vice versa.         R  Reset the  SELECT  status of all records to unselected, which            will show Sel=00000 . To select all records, use  R  then  I.         P  Purge-i.e. erase- all selected records. As with all erasures            confirm with the  Y  key.         T  Compute total and average of numeric data across all selected            records.  T  is  also  available  from   DISPLAY  mode.   See            TOTAL/AVERAGE.         V  Save program and file, or file only. See  LOAD AND 
SAVE.         U  Process all selected records via User Basic. See  USER BASIC.                                         9                                                                    EMPTY FILE         You should keep a version of  MASTERFILE which has an empty file         and use it whenever you need to start a new file application. To         creat your empty file,  you  must  clear  the  example  file  as         follows:           (a) Erase all records: MM RIPY           (b) Erase all report form
ats: MM E. Then  R1XY    which  erase               report format 1. Then  R2XY  to erase report 2, and so               on for  3, 4 etc. Then  M  back to  MM.           (c) Erase all data names: MM N. Then   EY,EY,  etc.  until  no               more data names are displayed. Then  M  back to  MM.         Now save the program, via  MM  VPEMPTY etc. This  also  provides         you with an additional back-up of the program. You may also wish         to save the empty file by itself, via MM V  F  EMPTY etc.
 Note         that  an empty file still contains essential system information         within  F$.                                    DATA NAMES         It is advisable-although not essential-to give each of your data         references a name. Data names can be up  to  128  characters  in         lengh, and are stored as part of the file. They are essential if         you wish to use auto-prompt when adding new records. Use   MM  N         to review or alter your data names. You will see the  same  menu    
     as appears in  ADD A RECORD  mode, but options  F and D  do  not         function. Use  A  to add a new data name, N  to  browse  through         the names, R to replace a name, E  to erase a name.  Use  M or D         to return to  MM.  The   order  in  which  you  add  data  names         determines the order in which data is auto-prompted.                                     EDIT MODE         Entered via  MM E EDIT  mode is concerned with the creation  and         modification of report formats. Up 
to 36 report formats  may  be         defined,  giving  that  many  logical  views  of  your  selected         records. Some effort is required to edit a  report  format,  but         this is typically a once-only task.         The menu reached via MM  E invites you to create  a  new  format         via  A  or review/alter an existing format via  R.  You can also         use  M  to return  to MM.         After A or R, give the report reference, 0-1,A-Z, as prompted.         The report reference Ref n is the
n shown at top right while in         EDIT mode.                                        10                                         When a report format is first created, it is given the following         General  characteristics:           a) Background paper colour of 7 (white)           b) Screen border colour of 7           c) Sequence-none, unsorted           d) Interval of one record every 2 lines         You can change these at any time just by  using  menu  option  R         while  General is displa
yed. You are then prompted for a  to  d.         Reply to  a  and  b  with key 0-7. Reply to  c   with  the  data         reference of the data by which the report is to be sequenced, or         else  ENTER  if no sequence is required. Reply to  d  with 1-22,         being  the  interval  down  the  screen  at  which  records  are         displayed.         To show just one record per screen, use an interval  of  22.  To         list one record every line,  use an interval of 1.         You must add some re
port elements:    these  describe  headings,         lines, boxes, and data to appear in  the  report.  There  is  no         limit to the number of elements. You can even display  the  same         data more than once . Use EDIT  menu  option  A  to  add  a  new         element, whereupon another menu asks what  kind  of  element  is         being added. All elements except data elements are  static,  and         will always appear whether or not any records are selected. They         are:           L  Lit
eral-e.g. title,column heading, currency symbol           B  Box- a rectangle drawn to pixel resolution           H  Horizontal line           V  Vertical line         For a literal, press  L  and supply the data as  prompted,  i.e.         line number, Micro-print*, column, paper, bright or not, inverse         or not, flash or not, and the literal text.  If  text  overflows         the right-most column it will resume on the next line,  column.         Ink colour is not prompted- MASTERFILE always uses co
ntrast.         For a box, press  B  and supply as prompted the co-ordinates  of         the top-left corner, depth in pixels less 1, with in pixels         less 1.         For a line, press  H   or    V    and  supply  as  prompted  the         left-most pixel, and the length in pixels less 1.         So much for the  static  elements-  now  we  consider  the  data         elements. Data elements specify which items of a record  are  to         be displayed, where, and with what attributes. Having pressed 
 A         to add an element, press  D and reply to a quite  long  list  of         prompts:           (a)  Data reference of the target item           (b)  Line - the line at which the first selected record is  to                display the item           (c)  Micro-print*           (d)  Column         *See MICRO-PRINT, next chapt                                        					11                                           (e)  Width - number  of  columns  wide.  MASTERFILE  lets  you                display da
ta in any character rectangle           (f)  Depth - number of lines deep           (g)  Spectrum attributes - paper, bright or  not,  inverse  or                not, flash or not           (h)  Pad or not - Pad will fill the rectangle with  the                chosen   paper colour.           (i)  Null text -  if data is absent in a record, then you  can                supply text to appear in its place, e.g.  not  known,                or-.The   default null text is a single space.         Numeric data wil
l be shown right-justified,  provided  that  the         field depth is 1, and  Pad=N.         The above fully describes how an  item  of  the  first  selected         record appears in your report. Items from further records   will         be displayed lower down the  screen,  at  whatever interval  you         have in  general.         You can browse through your report elements  by  using  N  (next         element), and any  element  can  be  replaced  by  using  R  and         then following the prompts
. There is  also  an  element    erase         option, E. You can go straight  to  DISPLAY  mode  via  D  ,  to         see the result of your changes.         The report format as a whole can be erased using  X,  or  copied         using C. C-copy- is  very  useful  when  you  want  to  build  a         format similar to one already built; perhaps you just  want  the         same layout but different sequence. After  C  or  X   you    see         the initial  EDIT  menu.         An interesting use of Null 
Text    is  to  use  an  unused  data         reference in a data element. This is how we  get  the  lines  of         dashes between records in our example file, REPORT 2.  The  null         text is a line of dashes, and always appears because the  target         data reference is never present in the records.         Plan your report formats on paper before coding them. Aim for an         exact number of records per screen, by  choosing  suitable  line         numbers  and  interval.  Beware   overlapping
    elements,    or         overlapping records- MASTERFILE does not check for these.                                        12                                                                    MICRO-PRINT         The normal character size of Spectrum allows 32  columns  across         the TV screen. By compressing the characters to  6-bit  or  even         5-bit with, instead of the normal 8-bit width,  more  characters         per line are made possible. The Micro-print feature  allows  two         degr
ees  of  compression,  either  to  42-column  pitch  or   to         51-column pitch. Thus any display can show  text  in  normal  or         compressed form, or any mixture. Both literal text and data text         can be so treated.         The advantages of Micro-print are not only that  more  data  per         screen is seen, but especially with 42-pitch the clarity can  be         enhanced due to the improved proportions of the characters.  The         only drawback is that  Micro-print  takes  a  littl
e  longer  to         generate, and data is painted rather than 'flashed up'.         The way to specify Micro   print is as follows:         In EDIT mode, when supplying a literal or data element, you  are         prompted with Micro-prt Y/N. Reply with the N key to  stay  with         32-pitch for that element. Otherwise, press Y and then  you  are         prompted with 42-Pitch Y/N.         Reply Y to select 42-pitch, or N to select 51-pitch  characters.         Then when you are prompted for column and 
with (in the  case  of         data elements), you will find that MASTERFILE lets you extend to         column 41 or 50, according to which pitch you selected.         Due to the way that Micro-print was built  into  MASTERFILE  (at         version 08) we have had to suppress the  FLASH  option for Micro         -printed text. Indeed,  EDIT  mode  displays  your  Micro-print          pitch in place  of  the  FLASH  status,  when  you  review  such         elements of a report.         Notice that when givin
g column number for a Micro-print element,         the number is in terms of the  selected pitch. The text will be          displayed at  X co-ordinate calculated as 6 times the column (if         42-pitch) or 5  times  (if  51-pitch).  The  approximate  'real'         column number is 6/8 or 5/8 of the Micro-print column.         Because of the attribute geometry of the ZX Spectrum, paper  and         ink colours must change only at natural character boundaries, so         you Micro-print text colour exten
ds  both  sides  to  a  natural         character edge.         The Micro-print feature of MASTERFILE is a  licensed  adaptation         of a package called MICROPRINT, which can be used  in  your  own         programs. The package is available from:           Myrmidon Software           P.O. Box 2, Tadworth, Surrey, KT20 7LU, ENGLAND                                        13                                                                  WORD PROCESSING         When data is displayed via  DISPLAY  mode, 
 MASTERFILE  performs         rudimentary  word-processing  such  that  leading  blanks    are         ignored a clean  left margin is maintained, and word-breaks are         minimised. This means that text can be entered without having to         worry about spacing. MASTERFILE will start  a  new  line  rather         than split a word, unless the last line is already reached.         The  vertical  line  character  (VLC)  has  a  special  use   in         MASTERFILE. A    VLC    is  found  via  Sinclair  
extended  mode         symbol-shift  S, i.e. the little red mark under the  S   key  of         the Spectrum keyboard. The  VLC  is a  force-line-break  signal,         so you may wish to use it in an address for example. You key the         text as a single data item but with VLCs as line separators. Now         when the data is  displayed  in  a  4-line-deep  paragraph,  for         example, each VLC forces a change of line.  This  is  ideal  for         address labels.         Notice that when in UPDATE 
 mode, item  data  is  shown  without         word-processing, and  VLCs are visable. But in   DISPLAY    mode         the  VLCs  do not appear.         If there is insufficient room to  display  an  item,  truncation         occurs on the screen, although the full  data  is  kept  in  the         file.                                 ADD A RECORD MODE         The usual way to add a new record is via  MM  A,   which  builds         an empty record onto the end of the file. The menu then  invites         you
 to add (insert) an item (A), auto-prompt items (P), or  exit         to  DISPLAY  mode (D) or to  MM  (M).  Other  menu  options  are         shown, but are not immediatelly applicable.         To put data into a new record, you can use  A   and  supply  the         data reference and the text.  The  text  is  a  maximum  of  128         characters,  and  trailing  spaces  are  dropped.  No    tokens,         graphics, colour controls, are allowed- they are altered to ? if         entered. CAPS SHIFT/LOCK 
may be used. The item is  displayed  in         bright white under its red data ref/name.         An alternative method  of  data  entry  is  via  (P),  which  is         Auto-Prompt. This causes MASTERFILE  to  solicit  each  item  by         scanning your data  names.  Auto-prompt  obviates  the  need  to         remember all your data references, and also makes it unlikely to         omit an item. You just enter text, concluding with  ENTER    for         each prompted item.  MASTERFILE    briefly  displ
ays  it  before         prompting the text item. If you have no data for an  item,  just         use  ENTER on its  own.  ENTER  quickly  followed by SPACE  will         end the prompts.                                        14                                         Having added one or more items, you can browse through them  for         checking, using  N  for each next  item.  And  you  can  replace         using  R, or erase  using  E.  Instead of holding the   N    key         down to reach an item, 
you can summon it directly using the    G         key  followed by the target data ref. But if you attempt to    G         an item which is not present, MASTERFILE waits for you to give a         different ref or back out via  ENTER.         If you use  R  to start a replacement, and wish to  back  out  ,         just delete or blank your reply and press    ENTER,   MASTERFILE         will leave the original item intact.         Before you can add another record, you must first go back to  MM         (M).  
       There is a way to insert a record at a particular place  in  the         file using  DISPLAY  mode  C.  See DISPLAY MODE.                                   DISPLAY MODE         DISPLAY mode is for viewing your selected records in    a    way         dictated by one of your report formats. You can display via   MM         D, but there are many other  menus  which  offer  the  same    D         option. The report format used is that which was last  used,  or         else the first format. Another way t
o DISPLAY mode is via  MM  C         where you choose a report ref.         The contents of lines 0-21 depend upon your report  format-  you         have a free hand here. Line 22 shows the following:           Report n   Q=menu  No more             (red)    (yellow)(blue)         where  n is the report reference, and the blue legend  can  be..         more  when there are more records to be displayed than there  is         room for on the current screen.         Once line 22 is displayed-some sequenced rep
orts can take a  few         moments to fill the page- a list of menu functions is available.         The menu is not normally shown,  but  you  can  summon  it  with         Q-and banish it again with Q. The functions are as follows:           N  If.. more is shown in line 22, use  N to see the next page              of the report.           1-9 Advance the report by 1-9 records. Sorry, we do not have              a 'back 1' function, so be careful not  to  overshoot.  Use              1-9 to position a re
cord at top-of-screen ready for options              U.E.O and C below.                                        15                                           B  Resume the report from the first record.           P  Copy lines 0-21 to the ZX Printer, or equivalent.  Use  the              S (single) to print just the  current  page.  Or,  use    A              (all) to print the current page and all further  pages.  To              abort a print, hold  H  key down or use  BREAK and GO TO 1.           U  Enter 
UPDATE mode with the top-most  displayed  record.  If              DISPLAY mode is resumed from UPDATE mode, the  same  target              record is shown.           E  Erase top-most record. (Y to confirm.)           O  (Letter O) un-selects the top-most record.  The  record  is              not erased.           C  Copy the top-most record. A new  record  identical  to  the              top-most record is inserted next to it. The copy record can              now be altered via  U  etc, and so here we hav
e a means  of              inserting a record at a particular place in the file.           S  Enter  Search mode.           T  Compute and display total/average.           R  Switch to a different report format, resuming at  the  same              top record as currently displayed. You are prompted for the              new report ref, and so it just needs  two  keys  to  switch              from one report to another. The reports need not be in  the              same sequence. This  facility  is  particular
ly  useful  to              switch from a summary report (say 20 records per page) to a              full expansion (1 record per page) of the top record.           M  Return to MM.           Q  Display the menu just described-press  Q again before doing              anything else.                                    UPDATE MODE         This mode is where a record can be updated, i.e.  its  component         items can be reviewed, replaced or erased, and new items can  be         added. The target record  fo
r  update  is  always  the  top  one         displayed in DISPLAY mode. Indeed,   UPDATE  mode  can  normally         only be reached from  DISPLAY mode, with  at  least  one  record         displayed. Use  N  and 1-9 keys to position the target record at         the top of the screen, then press U. Now you options are  almost         identical to those described in  ADD A RECORD MODE,  and  indeed         the same menus and prompts are offered. The difference  is  that         you can use  D  to resume   D
ISPLAY  mode  at  the  same  target         record on completion of the update.                                        16                                                                     EXERCISE         Here is a short exercise showing how to set up a simple file  of         names and telephone numbers, starting from an empty file. Follow         the steps described in  EMPTY  FILE  before  starting  this.  We         shall use the following notation:           +=ENTER key is pressed           +    (Do
 not key the comments in brackets)         Follow this exercise exactly, and  slowly-taking  note  of  every         menu and prompt. Start at MM of the empty file. We show the menu         responses as capital letters but you  can  use  unshifted  keys.         Here we go:         NANname+ATtel number +M ( this defines two data names:  name                +             +   for data ref N and tel number                                  for data ref T. Now we will add some                                  re
cords:)         AANJones P+AT01-234 5678+M (we have stored one record, with the                    +             +                                    telephon number of P. Jones.                                    Now for another record:)         APAtkins R+0232-66554+M (This time we used auto-prompt to enter                   +          +                          the data for R.Atkins. Do a few more this way:)         APSmith John+2332-45664+M                     +          +         APAirport+01-887 23459
+M                  +            +         APHairdresser+876-5432+M                      +        +                (We now have 5 records, and now we must use EDIT mode to                 compose a report format so we can view our file:)         EA1                (start of report ref 1)         AL0+N8+1YNNTelephone-List+ (Puts a heading Telephon-List in blue            +  +                  +  at line 0 column 8.)         ADN3+N1+16+1+7YNNN+ (To show names starting at line 3,col 1,16             +  +  + + 
    +   characters max, 1 line deep, paper white,                             bright, inverse no, flash  no,  pad  no,  no                             null text.)         ADT3+N18+14+1+2YNNN---+ (to show tel numbers starting at line 3             +   +  + +        + col 18, 14 characters max, 1 line  deep,                                 paper red, bright, inverse no, flash no,                                 pad no, null text of '---'.)                   (we can now test the report by going to DISPLAY mode
:)                                        17                                         D              (Looks OK, but how about sorting it by name, and                        making a few other changes? Go back to EDIT mode:)         MER1          (Review report ref 1:)         R76N3+      (Background paper stays white, border set to yellow,              +      sequence by N, interval to 3 lines.)         AB0+165+163+255+ (Now we have described a box. See the effects            +   +       +  of these changes
 now:)         D     (The display is stored by name-see why it is best to place                initials after surnames-and note the border and interval                changes. Now reset interval to 2 and finish off with some                refinements:)         MER1            (Review report ref1:)                                    R76N2+          (resets interval to 2)              +         ADZ4+N0+32+1+7NNNN--------------------+ (We have used data ref Z             +  +  + +                         + wh
ich is absent from our                                                 file.  There   are    32                                                   dashes. See effect:)         D               (Now let us update Jones-his number has changed:)         3               (Puts Jones at the top)         U               (to UPDATE mode)         GT              (get telephone number)         R01-995 3311+D (replace with new data, return to DISPLAY mode.)                     +                        (Finally, we can t
ake a save of the file:)         MVFTELNUM++                  ++             We leave you to experiment further-edit more report formats,             update the file, explore the search facilities, etc. Leave             no  menu option untried.                                        18                                                                    SEARCH MODE         We have seen that MM  RI will make the whole file available  for         DISPLAY mode viewing. But when a file is very long, it  is  mor
e         useful to let the computer pick out just the records  you  need.         SEARCH mode does this,  and  very  swiftly,  by  looking  at  a         particular item in each record and comparing it with an argument         which you supply. Records which qualify are flagged as  selected         and are reflected in the SEL=nnnnn value. To start a search from         scratch,  you  would  ensure  that  no  records  are    selected         initially. Use MM  R to set  SEL=00000. Now use  MM S  to  start 
        the search dialogue.         The first search menu invites A (all) or L (sel) or M(MM). Use A         to search all unselected records, and select those which match.         Use  L  to search  only  those  records  already  selected,  and         unselect those which do not  match.  The  use  of    L      will         decrease the count if any selected records fail to match.         Having pressed  A  or  L,  you  are  then  asked  for  the  data         reference of the items to be compared. Press 
 the  corresponding         key, or back out via  ENTER.         The next menu  asks  whether  the  data  is  to  be  treated  as         character (C) or numeric (N).  Numeric  data  is  normalised  in         flight to nnnnnnnnnnn.nn, e.g. 23.198 is treated as         00000000023.19 for the purpose of the comparison.         The next menu asks for the type of comparison, and a good way to         remember your choice here is the acronym G L U E S. Note that  S         (scan) only works if the previous men
u response is  C,  denoting         character search.         Finally, you are asked for the argument,  i.e.  the  value  with         which the target items are to be compared. If  you  have  chosen         numeric treatment, then the argument must be numeric too.         MASTERFILE then responds by updating the  Sel=nnnnn  count  and         re-offering the top SEARCH menu, from which you can  refine  the         search further, or exit to  MM or to DISPLAY mode.         Now let us examine in more detail 
the comparison process. For  a         numeric search, the  meanings    of    G,L,U  and  E  should  be         self-evident. But if a  record  does  not  have  a  target  item         present, then the comparison is  deemed  to  fail  even  if  the         comparison type is  U (unequal). If  a  record  is  met  with  a         non-numeric target item, then the search halts with the prompt         NON-NUMERIC DATA:SKIP (OR) UPDATE. If you choose  U    then  the         search cannot be resumed directly. S 
(skip) moves  on  the  next         record. If there are several non-numeric records, you  may  need         to keep  S pressed to several seconds.                                        19                                         Character search is a little more involved. (1) Upper  case  and         lower case letters are  considered  equal  for  the  purpose  of         comparison. (The same applies to sequence in DISPLAY mode).  (2)         If the argument is shorter than the  item  in  the  record,  b
ut         equal as far as it goes, then argument and  item are  considered         equal. Thus if we search for FRED  we will match records having         'FREDERICK','fred','Freda', etc. (3) If the  argument is  longer         than the item in the record, they will not match.  The  argument         'FRED' will not match a record 'FRE'.         Character scan (S)  hunts for    equality  anywhere  within  the         target items, so that the argument  'FRED'  will  match  strings         within the data  '
Alfred the Great' , 'Manfred Mann' , or  'Aunt         Freda'.         There is a way to search based upon the presense or  absence  of         an item, regardless of  its  value,  since  an  absent  item  is         considered to start with binary zero.  Thus  a  character  search         with argument '0' (note the leading  blank)  will  differentiate         records with the item from those without it. Use comparison type         L  to select those records without the item, and  G   to  select         th
ose with the item.         We have chosen the search menu letters so that with practice you         will soon makes searches without even looking at the menus. Your         search parameters are listed on the screen to remind   you  what         you entered. You can reach  SEARCH  mode directly from   DISPLAY         mode, as well as from  MM.         We finish this chapter with a  short  example  of  a  three-pass         search, which you can use on the example file.  We  will  search         for all reco
rds where 'salary' is between 14000  and  15000  and         'department' is 'admin'. Using  the  same  rotation  as  in  the         earlier  EXERCISE section, we start at MM:           RSASNG14000+      (gives us everyone with salary over 14000)                      +           LSNL15000+        (keeps only those with salary below 15000)                    +           LDCEadm+          (keeps only those with  department  starting                  +          'adm')           D                  (display the
 selected records)                                        20                                                                   TOTAL/AVERAGE         MASTERFILE can compute and display  the  total  and  average  of         numeric items of selected records. As with numeric  search,  the         data is normalised in flight, ignoring any decimal places beyond         the second. The total  is  displayed  with  most  leading  zeros         suppressed. Any non-numeric item halts the process with the same      
   skip/update option as described in SEARCH mode.  If  a  selected         record has no target item, then it is deemed to have value  zero         for the purpose of computing the average. Negative  numbers  are         not acceptable, and the only non-numeric character allowed is  a         single decimal point.         Total/average can be done from MM  or  from  DISPLAY  mode.  The         result is shown in lines 19-21. In DISPLAY  mode,  this  can  be         printed.         It is possible only to t
otal items of one data  reference  at  a         time. For more complex arithmetic processing one must write some         USER Basic, q.v.                                   LOAD AND SAVE         Use  MM V  to initiate a SAVE. A simple menu asks you to  choose         between F(file only) or P(program and file); or you can back out         with  ENTER.         When you select P, the save is in two parts.  First,  the  Basic         (which includes the F$ file), then the machine code.    You  are         aske
d for the save name, up to 10 characters, which becomes  the         name of the Basic component and is  displayed  in blue  in MM.         If you press  ENTER  alone, this is taken to mean 'same name  as         before'. The name used for the second part of the save is  built         into the Basic.         When you select F, only character array  F$ is  saved,  and  the         name is solicited as with  P.         You may wish to put an automatic  VERIFY  into line  4020,  just         before the GOTO US
R R:             VERIFY ""DATA F$():         (See BASIC COMMAND mode for how to access the Basic in order  to         make this change.) The VERIFY suggested here is applicable  only         to a file-only save, F, not to a program and file save, P.         Then after a file save, rewind the tape, insert ear  jack,  and         play the tape. If all is well, MM is resumed. Otherwise,  GOTO 1         and try the save again.         The file in F$ includes system  data,  data  names,  and  report         form
ats- as well as your file records.                                        21                                         To load any file which has been saved separately, i.e. via    MM         V F , you use MM V L. You must give the exact file name, or back         out with  ENTER. If you forget the name, just give a name of xxx         and  play  the tape.  Spectrum  will  display  Character  Array:         filename, and you can then  BREAK,  GOTO1,  and  try  again.  On         successful load, MM is resume
d with the new file name and revised         statistics. It is not necessary to purge a file  before  loading         another, since Spectrum wipes out  F$  before  loading  the  new         F$.         The load MASTERFILE initially, CLEAR nnnnn:LOAD"" and  play  any         tape which has on it a full save (i.e. saved via  MM V  P).  The         value of nnnnn for version 08 is 57036.         We suggest that you keep at  least  three  generations  of  your         files for security, using 3 or 4 cassettes
  in  rotation.  Never         make a save of the 'son' directly over the 'father',  since  any         power interruption would leave you with no file at all.         See  MICRODRIVE  for  adaptation  to  the  use  of    Microdrive         cartrides.                                    STATISTICS         MASTERFILE gives an almost constant display of file  statistics,         in line 23. This clears only while  text  is  being  keyed.  The         display consists of:           Recs=nnnnn Sel=nnnnn Spa=nnnn
n         The first  count is the number of records in the file, and  does         not include the special data names  and  report  format  records         which share  F$ with the file proper.         The second count is the number of records currently  flagged  as         SELECTED,  i.e.  eligible  for  display  in  DISPLAY  mode,  and         eligible for User  Basic,  total/average  etc.  Note  that  when         records are first created, they are created as  SELECTED.         The  third  figure  is  t
he  approximate  number  of  RAM  bytes         available for file expansion. The figure  varies    by  a  small         amount depending upon the machine stack, but is a good quide  to         the amount of spare space you have. Any attempt to overflow  the         file will result in a flashing red prompt  FILE  FULL    in  the         lower part of the screen. Press any key to resume, but with  the         last operation aborted. It is recommended that  old  records  be         purged, or the file split 
into two files (again via  MM P), when         spare bytes fall below 500 or so. And you will  need  even  more         spare space if the file is ever to  be  converted  to  cartridge         (see  MICRODRIVE).                                        22                                                                    USER BASIC         Although  MASTERFILE is a versatile filing system, all  it  does         is hold data, search it, and present it. Any processing  on  the         data is done by virtue of
 you updating individual items. But  if         you  are  prepared  to  write  some  Basic,  you  can    convert         MASTERFILE  into a file processor too. With User Basic  you  can         examine and even update the file. For example, suppose you  have         a file of pupil records, with a series of exam result  items  in         each record- you can compute the average mark   for  each  pupil         and store this as an extra item in each record.         User Basic is given control by MM U Y. Only
 selected records are         passed to User Basic for processing. The  program  as  delivered         has no User Basic other than a simple return, so that MM UY has         no effect on the file until some extra Basic is inserted.         When you invoke User Basic via MM U Y, Basic is given control at         specific line numbers, as follows:         Line 4900. Control comes to 4900 just once, before  any  records         are processed. You can  use  this  control  point  to  establish         parameter
s for use at the other points, e.g.  INPUT  a  discount         rate, or set a switch. As with  each  control  point,  you  must         terminate with a GOTO USR R statement.         Line 5000. Control comes here at  the  start  of  each  selected         record, but before any data from the record is passed. Use  this         to perform any record initialisation, e.g. zero an accumulator.         Terminate with GOTO USR R         Line 6000. Control comes here once for each item in  a  selected         rec
ord. The item is accesible in  C$,  which  is  a  dimensioned         character array, length 130. C$(1) is the  data  reference  A-Z,         and C$(2 TO) is  the data itself, right filled with spaces.  You         can store it into another variable if you need to use  the  data         later on. Think of line 6000 as 'data capture'.  Terminate  with         GOTO USR R.         Line 7000. Control comes here once  for  each  selected  record,         after all items have been  seen  at  line  6000.  Here  y
ou  can         perform processing on the data you captured at  line  6000,  and         then set up C$ in one of the following ways:           (a)  LET C$="" to signal that no change is to be  made  to the                record.           (b)  LET C$="X"-which sets C$(2 TO) to blanks-to  signal  that                the item whose data ref  is  'X'  is  to  be  erased,  if                present on the record. 'X' must be capital A-Z.           (c)  LET C$="X" and C$(2 TO)=data, to  signal  that  the  item 
               whose data ref is 'X' is to be inserted , or replaced  if                already there. 'X' must be capital A-Z.         Control must be returned to MASTERFILE proper via GOTO USR R.                                        23                                         Note that only one data item per record can be affected by  line         7000 in any one pass of User Basic. You might be able to provide         multiple item updates using several passes, but this would  need         some clever 
use of line 4900 etc.         Line 9000 (version 09 or higher only). Control comes here  once,         after all selected records have been processed. You may use this         point to print  totals,  reset  switches,  beep  a  'completion'         signal, etc.         Control must be returned to  MASTERFILE  via  GOTO USR R.         The order in which records  are  passed  though  User  Basic  is         unsequenced, i.e. the order the records were first  added to the         file. You must not re-dimensio
n C$, and on  no  account  disturb         variables F$ and R. Be prepared for relatively long delays while         User  Basic  processes  the  file.  Completion  of  User   Basic         processing is signalled by return of MM.         Use the technique described in BASIC COMMAND MODE to get into  a         position to code your User Basic. Once it is coded, GOTO USR 1         to return to  MM.  Test  it  on  just  a  few  selected  records         initially. When it works, take a program save via  MM V P
  etc,         so that you can use it thereafter.         We finish this chapter with a  simple  example  of  User  Basic,         where in a stock file are records which contain two relevant         items, quantify of stock  Q and unit cost    C.  We  require  to         generate a new item  V  being the value of  stock,  computed  as         the product of quantity  x unit  cost (Q*C). Further, we wish to         be able to recalculate all value data  on  demand.  It  is  very         easy:           4900
  GOTO USR R           5000  LET C=0: LETQ=0  :GOTO USR R           6000  IF C$(1)="Q" THEN LET Q=VAL C$(2 TO)           6010  IF C$(1)="C" THEN LET C=VAL C$(2 TO)           6020  GOTO USR R           7000  LET C$="V":LET C$(2 TO)=STR$(Q*C):GOTO USR R         Line 4900 has no file  initialisation  to  do.  Line  5000  sets         variables C and Q to zero in  case  we  don't  find  data  in  a         record-better a zero value than misleading residue  of  previous         record. Line 6000 etc. captures t
he Q  and  C  items,  and  also         converts them to numeric into variables of the same name- but we         could have used any suitable variable names. Line 7000 builds a         'V'  item and passes it back for insertion  or  replacement.  By         the way,  we  avoided  the  slicker  7000  LET  C$="V"+STR$(...'         because a bug in ROM sometimes gives a wrong result with string         concatenation.         In the above example, any non-numeric data in  the  quantity  or         unit cost dat
a would halt with  a  Basic  diagnostic.  For  this         situation, or any other halt, just recover with GOTO 1.                                        24                                                                    MICRODRIVE         With a few changes to the Basic part of  MASTERFILE, the program         will work perfectly with the Microdrive. Many users will be able         to adapt  MASTERFILE  themselves, but for the less confident, we         suggest an adaptation along the following lines.
  Remember  that         the Microdrive does not give you bigger  MASTERFILE  files- just         more convenient access.         Start by loading  MASTERFILE  from cassette in the  normal  way.         Include any  User Basic required, and empty the file.  Save  the         machine code by  breaking via  MM L  and CAPS SHIFT 6, entering         without line number:           SAVE *"m";1;"MF mcode"CODE 57037,8499 (see footnote)         Next, alter the lines which contain  SAVE and LOAD:           4020  SAVE
 *"m";VAL"1";C$(TO VAL "10")DATA F$():GOTO USR R           4030  SAVE *"m";VAL"1";C$(TO VAL "10") LINE VAL "4035":                 GOTO USR R           4035  LOAD *"m";VAL "1";"MF mcode "CODE:GOTO VAL "1"           4050  LOAD *"m";VAL "1";C$(TO VAL "10")DATA F$():GOTO USR R         And now alter line 1:           1 PRINT;:PAPER VAL "7":GOTO USR(etc)         (in case you  were  wondering,  VAL  "nnn"  saves  3  RAM  bytes         compared with just nnn).         GOTO 1 and take a save via  MM V P etc- this w
ill save just  the         Basic, and you need not do this again except after revising  you         User Basic.         Now, assuming you have earlier saved your  files  onto  cassette         via  MM V F etc, you must now transfer them to cartridge, and we         suggest the following little program:           10 LOAD "" DATA F$():INPUT N$:SAVE *"m";1;N$ DATA F$()         MASTERFILE modified as described will run  entirely  using  your         Microdrive number 1, and we suggest the use of  FILE SAVE rath
er         than  PROGRAM SAVE, for most  purposes.  Note  that  you  cannot         re-save onto the same cartridge  using  the  same  name,  so  we         recommend the use of data-stamped names, e.g. ACCT Aug 24.         This also helps you to read your CAT directory and decide  which         files are  old enough to be erased.         You should seriously consider backup of files either by saving to         a different cartridge, or copying to cassette as follows:           10 INPUT N$:LOAD*"m";1;N$ DAT
A F$():SAVE N$ DATA F$()         Note:'57037,8499' applies to MASTERFILE version  08;  for  other         versions, use 'n+1,65535-n' where n is the  CLEAR  number on the         cassette label.                                        								25                                                                    SOME POKES         To patch the machine code logic of  MASTERFILE, get into   BASIC         COMMAND Mode, and use  POKE with no line numbers.  Then  GOTO  1         and take a save via  MM V P etc. (
Or for  Microdrive,  save  the         machine code as described under  MICRODRIVE.)         Here are some possibilities:         (a)  If you want more than 26 data references, we  can  increase              the range to allow 0-9 and the special characters between 9              and A, as follows:               POKE 64282,48:POKE 64306,48:POKE 58166,48 (version 08) or               POKE 65534,48 (version 09 or higher)         (b)  When text is being keyed, the PIP    note  is  deliberately              mor
e audible than the Spectrum default. You can  POKE  this              to taste at 57725. (version 08) or  65535  (version  09  or              higher)                             OUTPUT TO NON-ZX PRINTERS         There are many interfaces which can connect dot-matrix and other         printers to a Spectrum. Because  MASTERFILE  does  its  printing         using a Basic  COPY (in line 4010), you must choose an interface         which will support COPY. Also the interface code must not  clash         with MF
 mcode, which runs in the top 8K or so  of  RAM.  TASMAN,         HILDERBAY, and KEMPSTON all have printer  interfaces  compatible         with  MASTERFILE. The KEMPSTON interface  even  has  transparent         COPY support.         There  are  two  methods  of    COPY-ASCII  and  HI-RES.   ASCII         transmits just standard ASCII characters as generated via the         SCREEN$ function. The advantages of ASCII are printing speed and         compatibility    with    all    kinds    of    printer,     e.
g.         daisy-wheel-disadvantages are that hi-res lines  and  boxes  are         not reproduced; neither is Micro-Print  data.  HI-RES  transmits         dot-for-dot, but is somewhat slower, and is only  applicable  to         dot-matrix printers. Many interfaces can also copy a double-size         image of the screen-4 dots for every screen pixel.         At the data of issue of this manual, the three named  interfaces         all support both ASCII and HI-RES  COPY  to  a  large  range  of         prin
ters, and are compatible with  MASTERFILE.                                        26                                         If you wish to print ASCII text beyond column 31, then  you  can         LPRINT through your interface within User  Basic.  However,  you         must then take responsibility for formatting the output. Also,         there is no way to sequence the selected records  as  they  pass         through User Basic.         For  more  information  about  interfaces,  please  contact  the    
     suppliers named above. Advice is also available from   TRANSFORM         Ltd who retail both printers and interfaces, and who  also  have         experience with  MASTERFILE. See the  computer  press,  such  as         Sinlair User, for addresses and telephone numbers.                        MASTERFILE VERSION 09 ENHANCEMENTS         (a) DISPLAY mode: Backspace by one record can be done, by  using             the 0(zero) key. Note that for sequenced  reports  this  can             take several seconds.
         (b) ADD RECORD mode: You can add another  record  without  going             back to MM by using the =menu option, provided that at least             one item is present in the current record.         (c) Word processing: VLC behaves like  a  space  when  text  has             reached the bottom line of its paragraph. So whereas  before             a VLC in the last line would truncate the text,  version  09             will print text to the end of paragraph.         (d) User Basic: This has  an  
'end-of-file'  control  point,  at             Basic line 9000.                                 COPYRIGHT NOTICE         Program  MASTERFILE and this manual are the copyright of Cambell         System and may not be reproduced, hired, or re-sold without  the         written consent of Campbell Systems.         We allow and expect legitimate users to take back-up  copies  of         the program for their own security.         CAMPBELL SYSTEMS         15 Rous Road, Buckhurst Hill, Essex IG9 6BL, ENGLAND.     
                                   27
                                                                                                                                                                                                                         