P729 CJJFA( 729 Mon 3 Nov 21:24/23 |B2201204|b1vFInitT|j13BBC|l43000|s—:8 |p÷e DISK NUMBER : DISKCAT EGORZ : DISC÷e FILENAMEFIVES T÷e ÷e ÷e MACHINE BB C B/B+/Master÷e BASIC Any OS, Any DOS÷e PERIPHERALS  Disc Drives÷e TAPE COMPATIBILITY  No÷e ÷e ÷e LIVENUMBER  20300-20630÷e NAME PROCF#I F$,rw)÷i AUTHOR JM ÷e REFERENCE RAR tines÷e ÷e CLASSIFICATION D Random Access÷e DESCRJPTJON R s the file parameters and sets up ÷e÷a÷a  he÷e  ÷e PARAMETERS REQUIRED F$ N ame of the file to be used.÷e  1 if file is to be read only.÷e  2 to allow write to file.÷e÷e PARAM ETERS RETURNED GLOB AL VARJABLJS REFERENCED None÷e GLO BAL VARJABLJS AFFECTED Rmax% |c
P729 CEEFAX 729 Mon 3 Nov 21:12/57 |B2202204|a1vFInitT|j13BBC|l434AF|s—:8 |p Max number of records held÷e   /write jlag.÷e RRA records in memory.÷e A ray for lengths of fields.÷e  e% Handle for opened file.÷e  d* Offset to start of records.÷e last% Last valid record number.÷e ÷e ÷e MODE DEPENDENCE N j÷e ÷e OTHER MODULES CALLED N nj÷e OTHER MODULES RELATED  F.READ, F.WRITE÷e ÷e COMMENTS This procedure initialisjs the aura ys ÷e READ nd WRITE.÷eThe records in memory are del d in an array R$. An array is used so t hat÷esjveral records are in memory simul taneously, this cuts down on disc÷etrans fess when only a few records are in use and speeds things up÷econsiderably. The last valid record number and the length s of each field÷ease recovered from |c
P729 CEEFAX 729 Mon 3 Nov 21:17/12 |B2203204|b1vFInitT|j13BBC|l43908|s—:8 |pthj file hjadjr and held in last % and array len*.÷eLast% can either bj t he end of the file or it can be the last record used÷ear the file is extended.÷e TYPICALCALLANDLISTING ÷e 10 REM Random File Routines÷e 20 :÷e 30 REM Initialisj÷e 40 PROCF#Ini t("test",2I÷e 110 :÷e 120 EVD÷e Q30 : ÷e20300 REM **************************** *÷e20310 REM * REMR don File Initialisj *÷e20330 REM * ( c) 1986 J. Meets *÷e20340 REM * Pre stel Mailbox 707327277 *÷e20350 REM * *÷e40360 REM ************************ *****÷e20370 :÷e20380 REM Open & Initial ese file system÷e20390 REM F$=File name÷ e40400 REM rw=1 read only, rw=2 read/wri te÷e20410 :÷e20420 DEF PROCF#Init(F$,rw) ÷e20430 LOCAL max#flds÷e20440 REM GLOBAL R*, Rmax%, rw%÷e20450 REM GLOBAL#ARRAYS R$, lin%÷i20460 REM Set up key to disp lay stored records÷e20470 *KEY5 F.i%|c
P729 CJEFA( 729 Mon 3 Nov 21:12/40 |B2204204|a16FInitT|i13BBC|l43C94|s—:8 |p=0TORmax%:IFLEFT$(R$(i%),1)<>" " THENP.R$(i%):N.ELSEN.||M÷e20480 REM Aura ys for length of fields and records in m emory÷e20490 max#flds=20:DIM len%(max#fl ds*÷e20500 Rmax%=20:DIM R$(Rmax%)÷e20510 rw%=rw:REM Set read/write flag÷e20520 P ROCF#param(F$)÷e20530 ENDPROC÷e20540 :÷e 205u0 DEF PROCF#param(N$):LOCAL i%,x%,H$ ÷e20560 REM GLOBAL handle%,last%÷e40570 handle%=OPENIN N$÷e40580 INPUT£handle%,l ats%,H$÷e20590 REM Get the field lengths ÷e20600 len*(0)=1÷e20610 FOR i%=1 TO LEN (H$)/2:len*(i%)=VALMID$(H$,2*i%-1,2):oEX T÷e20620 ENDPROC÷e20630 :÷e|c
P729 CJEFAX 729 Mon 3 Nov 21:23/25 |B2201202|a15FInit|i24BBBC332k|l43000|p÷ e20300REM *****************************÷ e20310RJM * *÷ e20320REM * Random File Initialisj *÷ j20330RJM * (c) 1986 J. Meets *÷ j20340REZ * Prestel Mailbox 707327277 *÷ j203u0RJZ * *÷ e40360REM *****************************÷ e40370:÷e20380REM Open & Initialise file system÷e20390REM F$=File name÷e20400REM rw=1 read only, rw=2 read/write÷e20410: ÷e20420DEF PROCF#Init(F$,rw)÷e20430LOCAL max#flds÷e20440REM GLOBAL R%, Rmax%, rw %÷e20450REM GLOBAL#ARRAYS R$, len*÷e204 60REM Set up key to display stored recor ds÷e20470*KEYs F.i%=0TORmax%:IFLEFT$(R$( i%),1)<>" "THENP.R$(i%):N.ELSEN.||M÷e204 80RJM Arrays for length of fields and re cords in memory÷e20490max#flds=20:DIM le n*(max#flds)÷e20500Rmax%=20:DIM R$(Rmax% I÷e20510rw%=rw:REM Set read/write flag÷e 20520PROCF#param(F$)÷e20530ENDPROC÷e2054 0:÷e20550DEF PROCF#param(N$):LOCAL i|c
P729 CEEFAX 729 Mon 3 Nov 21:11/40 |B2202202|a15FInit|j24BBBC332k|l43352|p% ,x%,H$÷i20560REM GLOBAL handle%,last%÷e2 0570handle%=OPENIN N$÷e20580INPUT£handle %,last%,H$÷e20590REM Get the field lengt hs÷e20600len*(0)=1÷e20610FOR i%=1 TO LEN (H$)/2:lin*(i%)=VALMID$(H$,2*i%-1,2):oEX T÷e20620ENDPROC÷e20630:÷e|c