8-Bit Software Online Conversion

Address Database - Listing

10REM G.C.S.E COMPUTER PROJECT 20REM By Andrew Black 30REM (C) Andrew Soft 1990 40REM 50REM ADDRESS BOOK 60: 70REM" This program has been placed 80REM" into Public Domain. 90: 100ONERRORPROCerror(0) 110: 120MODE7 130VDU23;8202;0;0;0; 140: 150PROCinit 160PROCtitle 170PROCmenu 180END 190: 200DEF PROCmenu 210CLS 220PRINT'" 1. Create data file" 230PRINT'" 2. Browse through datafile" 240PRINT'" 3. Search using number" 250PRINT'" 4. Recover deleted record" 260PRINT'" 5. Delete record" 270PRINT'" 6. Add record" 280PRINT'" 7. Amend record" 290PRINT'" 8. Print records" 300PRINT'" 9. Exit" 310PRINT'" Which one?":temp%=GET-48 320: 330IF temp%=1 THEN PROCcreate 340IF temp%=2 THEN PROCbrowse(0) 350IF temp%=3 THEN PROCnnumber 360IF temp%=4 THEN PROCdelete`recover( 0) 370IF temp%=5 THEN PROCdelete`recover( 9) 380IF temp%=6 THEN PROCadd 390IF temp%=7 THEN PROCamend 400IF temp%=8 THEN PROCbrowse(1) 410IF temp%=9 THEN PROCexit ELSE PROCm enu 420ENDPROC 430: 440DEFPROCtitle 450CLS 460PRINT"  ppppppppppp"; 470VDU134,157,141 480PRINT" Address Database by Andrew B lack" 490VDU134,157,141 500PRINT" Address Database by Andrew B lack" 510PRINT"  £££££££££££" 520VDU28,0,24,39,4 530ENDPROC 540: 550DEF PROCcreate 560CLS 570PRINT" Create mode" 580PRINT 590INPUT" How many records:"rec% 600IF rec%<1 THEN PROCcreate 610rec%=rec%-1 620: 630channel=OPENOUT("DATFILE") 640pointer=PTR# channel 650start%=0 660: 670PROCcreate`add 680ENDPROC 690: 700DEF PROCstrip(var%) 710name$=FNcheck(name$) 720address$=FNcheck(address$) 730town$=FNcheck(town$) 740county$=FNcheck(county$) 750post`code$=FNcheck(post`code$) 760telephone$=FNcheck(telephone$) 770ENDPROC 780: 790DEF FNcheck(var$) 800length%=LEN(var$) 810IF length%>=20 AND var%=0 THEN =LEF T$(var$,20) 820IF length%<20 AND var%=0 THEN =var$ +STRING$(20-LEN(var$),"#") 830IF var%=1 THEN =LEFT$(var$,(INSTR(v ar$,"#")-1)) 840: 850DEF PROCbrowse(type`of`print%) 860CLS 870PRINT" Browse Mode" 880: 890channel=OPENIN("DATFILE") 900IF channel=0 THEN PROCerror(1) 910records=EXT# channel DIV 142 920records=records-1 930: 940FOR num=0 TO records STEP 1 950PTR# channel=num*142 960IF type`of`print%=0 THEN CLS 970: 980PROCdisc`input 990: 1000IF state%=0 THEN PROCprint`record 1010NEXT num 1020: 1030PROCclose 1040CLS:PRINT'" End of file." 1050PROCspace 1060ENDPROC 1070: 1080DEF PROCspace 1090PRINTTAB(0,19)SPC8" Press Space to continue" 1100REPEATUNTILGET=32 1110ENDPROC 1120: 1130DEF PROCprint`record 1140: 1150IF type`of`print%=1 THEN VDU2 1160: 1170PROCstrip(1) 1180PRINT" Record number:";record%+1 1190PRINT' 1200PRINT" Name : ";name$ 1210PRINT" Address : ";address$ 1220PRINT" Town : ";town$ 1230PRINT" County : ";county$ 1240PRINT" Post Code: ";post`code$ 1250PRINT" Telephone: ";telephone$ 1260PRINT' 1270IF type`of`print%=1 THEN VDU3 ELSE PROCspace 1280ENDPROC 1290: 1300: 1310DEF PROCnnumber 1320CLS 1330PRINT" Search Mode" 1340PROCdelete`search 1350: 1360IF bad%=1 THEN PROCerror(2):ENDPROC 1370: 1380PROCclose 1390: 1400IF state%=9 THEN PROCerror(4):ENDPR OC 1410CLS 1420PROCprint`record 1430PROCspace 1440ENDPROC 1450: 1460DEF PROCdelete`recover(switch%) 1470CLS 1480: 1490IF switch%=0 THEN PRINT" Recover Mo de" ELSE PRINT" Delete Mode" 1500PROCdelete`search 1510: 1520IF bad%=1 THEN PROCerror(2):ENDPROC 1530: 1540IF state%=9 AND switch%=9 THEN PROC error(3):ENDPROC 1550: 1560IF state%=0 AND switch%=0 THEN PROC error(5):ENDPROC 1570: 1580PRINT:PRINT" Are you sure?" 1590temp$=GET$ 1600: 1610IF temp$="N" THEN PROCclose:PROCspa ce:ENDPROC 1620: 1630PTR# channel=rec%*142 1640: 1650state%=switch% 1660PROCdisc`print 1670: 1680IF switch%=9 PRINT'" Record deleted " ELSE PRINT'" Record recovered" 1690: 1700PROCclose 1710PROCspace 1720ENDPROC 1730: 1740DEF PROCdelete`search 1750bad%=0 1760PRINT 1770INPUT" Enter record number",rec% 1780: 1790IF rec%<1 THEN bad%=1:ENDPROC 1800rec%=rec%-1 1810channel=OPENUP("DATFILE") 1820: 1830IF channel=0 THEN PROCerror(1) 1840: 1850check%=EXT# channel DIV 142 1860: 1870IF rec%>check% THEN bad%=1:ENDPROC 1880: 1890PTR# channel=rec%*142 1900: 1910PROCdisc`input 1920ENDPROC 1930: 1940DEF PROCexit 1950CLS 1960PRINT" Exit?" 1970temp$=GET$ 1980IF temp$="Y" OR temp$="y" THEN CALL !-4 ELSE PROCmenu 1990ENDPROC 2000: 2010DEF PROCcreate`add 2020FOR num=start% TO rec% STEP 1 2030CLS 2040PRINT" Record number:";num+1 2050: 2060PROCinput 2070: 2080record%=num 2090state%=0 2100CLS:PRINT'" Writing record" 2110PTR# channel=pointer+(num*142) 2120: 2130PROCdisc`print 2140: 2150NEXT num 2160CLS:PRINT'" Finished writing all re cords." 2170PROCclose 2180PROCspace 2190ENDPROC 2200: 2210DEF PROCadd 2220CLS 2230PRINT" Add Mode" 2240PRINT 2250INPUT" How many extra records:"rec% 2260IF rec%<1 THEN PROCadd 2270rec%=rec%-1 2280channel=OPENUP("DATFILE") 2290IF channel=0 THEN PROCerror(1) 2300pointer=PTR# channel 2310: 2320start%=EXT# channel DIV 142 2330rec%=start%+rec% 2340: 2350PROCcreate`add 2360ENDPROC 2370: 2380DEF PROCinput 2390PRINT' 2400INPUTLINE" Enter name :"name$ 2410INPUTLINE" Enter address :"address $ 2420INPUTLINE" Enter town :"town$ 2430INPUTLINE" Enter county :"county$ 2440INPUTLINE" Enter post code:"post`co de$ 2450INPUTLINE" Enter telephone:"telepho ne$ 2460PROCstrip(0) 2470ENDPROC 2480: 2490DEF PROCdisc`print 2500PRINT# channel,record%,state%,name$ ,address$,town$,county$,post`code$,telep hone$ 2510ENDPROC 2520: 2530DEF PROCdisc`input 2540INPUT# channel,record%,state%,name$ ,address$,town$,county$,post`code$,telep hone$ 2550ENDPROC 2560: 2570DEF PROCamend 2580type`of`print%=0 2590CLS 2600PRINT" Amend Mode" 2610PROCdelete`search 2620: 2630IF bad%=1 THEN PROCerror(2):ENDPROC 2640: 2650IF state%=9 THEN PROCclose:PROCerro r(4):ENDPROC 2660: 2670CLS 2680PROCprint`record 2690: 2700CLS 2710PRINT" Are you sure?" 2720temp$=GET$ 2730: 2740IF temp$="N" OR temp$="n" THEN PROC space:PROCclose:ENDPROC 2750CLS 2760PRINT" Record number:";record%+1 2770: 2780PROCinput 2790: 2800PTR# channel=rec%*142 2810: 2820PROCdisc`print 2830: 2840CLS 2850PRINT" Writing record" 2860PROCclose 2870PROCspace 2880ENDPROC 2890: 2900DEF PROCerror(err%) 2910: 2920IF ERR=223 THEN PROCclose:PRINT'rec 3$:ENDPROC 2930: 2940IF err%=1 THEN PROCclose:CLS:PRINT' " DATFILE not found":PROCspace:PROCmenu 2950: 2960IF err%=0 THEN PROCclose:CLS:REPORT :PROCspace:PROCmenu 2970: 2980IF err%=3 OR err%=5 OR err%=2 THEN PROCclose 2990: 3000IF err%=3 THEN PRINT'rec1$;"already ";rec2$ 3010: 3020IF err%=4 THEN PRINT'rec1$;rec2$ 3030: 3040IF err%=5 THEN PRINT'rec1$;"not ";r ec2$ 3050: 3060IF err%=2 THEN PRINT'rec3$ 3070: 3080PROCspace 3090ENDPROC 3100: 3110DEF PROCclose 3120CLOSE#0 3130ENDPROC 3140: 3150DEF PROCinit 3160rec1$=" Record has " 3170rec2$="been deleted" 3180rec3$=" Record does not exist" 3190ENDPROC