P727 CEEFAX 727 Wed 30 Dec 21:00/51 |B2201215|a16DBinfo|i14TEXT|m10|s÷n1÷e A DATA-BASE SYSTEM by ROB ANDER SON. INTRODUCTION T am enables a collection of records (of a ny format) to  of ways, and should provide a good intro duction  s in general. By following the BASIC  gram listing it should also give the rea der an insight into how such a  rks, and ultimately how to go about writ ing a system of your own. T ta that goes to make up the data-file is held in computer  trict the amount of data that can be sto red in one  d very fast access times to the data are  it also provides a good way for  ers to store a reasonable amount of reco rds without having to wait  or it all to load. T is system could be of use to : T
P727 CEEFAX 727 Wed 30 Dec 21:11/17 |B2202215|a16DBinfo|i14TEXT|m336E|s÷n1÷e ape and disc users who require a small b ut fast data-base system to  ample names, addresses and telephone num bers, of which roughly  be stored using a reasonably sized reco rd format. S ed a data-base system before, and is wan ting  so as to obtain a better understanding of the basic principles involved.  From the programming point of view there is a full description of the  tc. included in this article, which may help someone to write a  own. WHATDATABASEDOES A suggests, this program is a data base th at enables pieces of  d recalled and, once entered, this data can be  that are described later. The types of ata entered are up to you, but for examp le the system could hold n—lfs, 
P727 CEEFAX 727 Wed 30 Dec 21:30/40 |B2203215|a16DBinfo|i14TEXT|m36DA|s÷n1÷e esses and phone numbers, which could the n be recalled whenever you B going on, I will now explain what exactl y a data file is,  st of the article easier to follow. S ll using our example of a names file, a typical entry (which is called RECORD , may be : RECORD  -------- NAMEBOBANDERSON ADDRESS 13 BACKERS FIELD, MARTON  THE BORO, ENGLAND PHONEN OS: (0123) 456789  ----- TNAMEADDRESS , and "PHONE NOS :" are the FIELD TITLES ,  s been set up. A ave been defined, you then have to defin e the  unt of characters that may be needed to hold, for example, an address. In the ab ove example, a good field length  field title "NAME :" would be about|c
P727 CEEFAX 727 Wed 30 Dec 21:20/00 |B2204215|a16DBinfo|i14TEXT|m3A46|s÷n1÷e 20, because it would be  e a l—lf with more than 20 characters in it. ADATABASE s you to firstly enter the field titles and field lengths that are wanted for th e file, and once set up, the user  en enter records into the file. SCREEN LAYOUT : TMODE in, thus leaving plenty of memory for t he T o three main areas. The top part of  screen gives details of thg commands ava ilable, and whenever a command  ed, a more detailed explanation is given . T to display the currently selected  d, while the bottom of the screen gives details aboqt the current  luding the amount of records currently i n the file, the  the last filename entered and the record number of 
P727 CEEFAX 727 Wed 30 Dec 21:20/26 |B2205215|a16DBinfo|i14TEXT|m3DB2|s÷n1÷e tly being displayed. DATABASECOMMANDS : A ted, DATABASE also supports certain  ands that can do various things to the r ecords that have been entered. T nds are accessed by simply pressing the appropriate key, upon  given information about how to use the c ommand and what I se a command that cannot be used at that moment  to a file that does not exist), the  gram will inform you, and also give you a hint as to what might have  and how to remedy the problem. The prog ram is very user  t, and because of this you should soon l earn how to  st potential. Do not worry about crashin g tha  legal operating system call because  e is an error checking routine that |c
P727 CEEFAX 727 Wed 30 Dec 21:20/49 etraps any errors, reports them,  n returns control back to the program wi thout losing the data file  ently in memory (if there was one). T commands available are : AADD add a record. BBA K - backstep th rough the fila. DDELETE ecord. EEDIT F FORWARD forwardstep through the file. KKEEP LLOAD - load t—e file. NNEW new file. OORDER  NT - send file to printer. RRESET - reset DATABASE. SSEARCH for a record. ADATA BASE is very qser-friendly, and you shoq ld have  but in case there are a faw points that are still not clear when using the progr am, an explanation is now given of 
P727 CEEFAX 727 Wed 30 Dec 21:00/36 |B2208215|a16DBinfo|i14 DXTF ecommands and what they do. KEEPR in the data file in memory being saved to the currently  which can then be loaded in ssing LOAD. LOAD Enables a previously saved file to bd loaded in from a filing A er typing in tha filename of tha data fi le, you will also have  assword that has previously been givdn t o the file, and  assword has been entered will the rest o f the file W the password, it will not be printed up on  else seeing it! If an attempt is made  o load a data file that was not created by DATABASE, the file will be  NEGT be created, provided thare is not a  e already in memory upon which it will h ave to be deleted using RESET. W—dn def ining a file, the first thing that m|c
P727 CEEFAX 727 Wed 30 Dec 21:30/59 |B2209215|a16DBinfo|i14TEXT|m41B5F|s÷n1÷ eust be done is to define the  les, afterwhich the field lengths must b e enteredN Great care  defining these because they cannot be l ater changed. Y roblems setting up a file because the pr ogram  o go about it. Finally you will be asked  file, which will stop any  people from seeing your info.. (cvt make sure you remember  won't be able to see your file either!). ORDERT ch other, which enables you to move  records around the file so as to put th em in the order you want them. W use the command, you will be asked for two record numbers, which  o be swapped. OST simply keep SHIFT pressed and then hit the * A
P727 CEEFAX 727 Wed 30 Dec 21:20/23 ethe screen, afterwhich yoq can enter yo ur  T es you to do things such as  a disc (*CAT), or selecting a filing sys tem (*DISC, *TAPE  F s of operating system commands, sce page 416 of the  PRINTI ter is connected to your computer you wi ll be able to get a  le record, or the whole file. When print ing out all  ked for an inter-record space character which  seperate each record on the paper (a  uitable character is a '-'), BDSET  you press 'R' this wipes the memory wher e the current file  ng out the file Usa this command carefu lly, and  tha file bdfore using ESET SEARCHT command enables you to find a record qu ickly by asking for 
P727 CEEFAX 727 Wed 30 Dec 21:20/46 e, afterwhich it will search the file fo r another  tch. Upon deciding which is the best  t, it will print out the closest matchin g record. So, for example,  d to know Mike's phone number, you would enter Mike into  en the computer would come up with the r est of IM ke's in tha file then you would havd  specify his second name in the search r ecord (i.e. MIKE DIXON). TECHNICALPOIN TS OF THE P OGRAM DATABASE the way most programs are; a big main p rogram loop at  y loads of procedures that are called up from  B gram is quite easy to follow, with each command being allocated a separate subro utine (see list of procedures). W eed is important (e.g. when printing a r ecord while scanning), the 
P727 CEEFAX 727 Wed 30 Dec 21:22/09 |B220C215|a16DBinfo|i14 DXTA eas been coded accordingly, using intege r variables etc.. T each of the features is fairly standard , but with a  d load functions do their bob by saving the  using *LOAD and *SAVE), which  poses a problem because you cannot spec ify a filename in a  e, so a string had to be built qp in mem ory, and then  ne interpreter (at &FFF7 n Although in B ASIC2 OSCLI he way it is ensures compatibility with BASIC1. Another unusual point of the pro gram is the extensive use of  operators to store the records diractly in memory which, while  o program in whan compared to the ease o f use of arrays,  merits that are explained latar. I be seen that *FX200,1 and *FX200,0 |c
P727 CEEFAX 727 Wed 30 Dec 21:32/33 |B220D215|a16DBinfo|i14TEXT|m4290B|s÷n1÷ eare used a lot, which enable and  e the ESCAPE key. The reason is that whi le the escape key works most  , enabling you to get out of a command t hat you accidently  dangerous to escape when, for example, d eleting a ESCAPE ressed while the program was shifting al l  leted record, the whole file could  rrupted. So to prevent this the escape k ey is disabled just before  s entered, and then enabled after leavin g the routine. This  the routines. T in the program works on a token basis, g iving  that matches with the search record, and  ost points. If two records get the  points, the first one encountered in the file is output, and because 
P727 CEEFAX 727 Wed 30 Dec 21:00/56 |B220E215|a16DBinfo|i14 DXT|m42C76|s÷n1÷ e it is always best to put as much infor mation in the search record  emember. PROCEDURESLINENOSDESCRI PTION I s variables etc..  Analyses error & reacts acordingly. set screen 390 Sets up screen.  480 Performs ADD command PBACK mmand. PD ELETE command. P rforms ADIT command.  Parforms FORWARD command.  1190 Performs HALP command.  1220 Performs KEEP command . PLOAD ommand. P NEW command. o 1770 Peqf orms *OS command.  Performs PRINT command.  1980 Performs SEARCH command.  2230 Performs RESET comma|c
P727 CEEFAX 727 Wed 30 Dec 21:35/21 |B220F215|a16DBinfo|i14TEXT|m42FE1|s÷n1÷ end. PORD ER command. S top text window.  Sets bottom text window.  2430 Prints out commands available in the top text  dow. P nd that has just been selected in a  a 'pretty' blue box! sp 2470 Asks user to pres s the space bar to continue.  2490 Asks if you really want to c ontinue. If so  '=0, otherwise 'ss'=1.  20 Wipes file memory.  2570 Prints the current record held i n 'record'. P s the field titles of the file.  2810 Asks the user for a filen ame. T er that a file already exists.  2890 Tells the user that th|c
P727 CEEFAX 727 Wed 30 Dec 21:11/41 |B2210215|a16DBinfo|i14PDXT|m4334C|s÷n1÷ eere are no records  currently in the file. G 2910 Gets the contents of a two byte number (G is the  first byte minus 'starta'), and places the result  H' .  GP of 'H' in two memory bytes  starting at 'G+starta'.  A$) 2950 Passes 'A$' onto the co mmand line interpreter.  This routine will work in BASIC 1 and BASIC 2. I qts a record from the keyboard into a st ring. IMPORTANTVARIABLESDESCRIPTION A%,B%,C%,D%,E%,F%,G%,X%,Y% USED IN VARI OUS LOOPS. ABCDEFGHIJKU SED IN VARIOUS LOOPS flag Ased to flag certain avents. lag2 Used to flag certain events.  Holds record number that is curr|c
P727 CEEFAX 727 Wed 30 Dec 21:04/01 |B2211211|a16DBinfo|i14TEX @ eently being  displayed  A flag for PROCEDU D  Points at start of memor y for the file. ABC Used for various string handling rou tines. H last filel—ld entered.  n(16) Usdd to hold a record as a s tring. FILEFORMAT T d titles and field lengths are all kept in memory up BASIC d are dumpdd directly there using indire ction T mainly for memory saving becausd  h string arrays are very nice and easy t o use, they tend to take up  ory, which is very important when all th e records are in  T tual contents of the file start at t—d m emory location stored in  the password, field titles, etc. ar|c
P727 CEEFAX 727 Wed 30 Dec 21:06/33 |B2212215|a16DBinfo|h14TEXT|m43A02|s÷n1÷ ee kept. After this  emselves which follow on one after the o ther. MEMORYUSAGE DATABASE BASIC program which can —e run at any P AGE address less  Tha data file rasides at &4100, which i s what the HIMEM to prevent BASIC running into the data f ile. TTOP &4000, which leaves (HIMEM-TOP)=1k  s for variable storagd. Tha top of usdr memory is &7C00, so this C 4500)=14k bytes of memory free for the d ata file, which  ut 200 records of 5 fields of 10 charact ers per  uite a useful size. MAMORYUSAGESAMMAR Y :    . MODE .  ### ################### &7C00 N DATAFILE
P727 CEEFAX 727 Wed 30 Dec 21:07/56 |B2213215|a16DBinfo|i14TEXT|m43D8D|s÷n1÷ e .  #### ################## HIMEM = &4500  . VARIABLESTOR AGE .  ## #################### TOP = &4000  . BASICPOGRA M .  ## #################### PAGE = &1900  .  . TAPEUSERS DATABASE ite suited to tape users due to it keepi ng all the records  d so they only have to be loaded once, a fterwhich all  in computer memory. By saving and loadin g the data using *SAVE and *LOAD also me ans that the data can be saved/ loaded uch more quickly than if BASIC's FILE co mmmands (such as PRINT£, PTR£  used. EFFICIENTUSEOFDATABASE W using DATABASE there are a few little t ips that can make it easier 
P727 CEEFAX 727 Wed 30 Dec 21:37/10 |B2214215|a16DBinfo|i14TEXT|m440F8|s÷n1÷ e efficient to use. WNE record, think carefully about how to de fine it because  be changed which means that if you have entered  ut that you need another field for certa in  ole file in again! Because of this,  s also a good idea to have a field calle d 'ANYTHING ELSE' or MISCELLANEOUS r records that may have unusual entries. W an still use the function keys to MO DE 7 coloured characters, which enables you to set up a file that  l, making it easier and more colourful t o use (although you  coming from your printer when printing a record!). I urity precautions, use the password 'DAT ABASE'  ed by the program which makes it 
P727 CEEFAX 727 Wed 30 Dec 21:18/00 |B2215215|a16DBinfo|i14TEXT|m44463|s÷n1÷ eossible for you to forget! A y note, ALWAYS KEEP COPIES OF YOUR DATA FILES, because if you  to learn the hard way, so be warned! R S.ANDERSON. JAN 1987. 
P727 CEEFAX 727 Wed 30 Dec 21:27/03 eossible for you to forget! A y note, ALWAYS KEEP COPIES OF YOUR DATA FILES, because if you  to learn the hard way, so be warned! R S.ANDERSON. JAN 1987. 