P735 CJEFAX 735 Mon 10 Nov 21:24/07 |B2201204|b1vFInjtT|j13BBC|l43000}s—:8 |p÷e DISK NUMBER : DISKCAT EGORZ : DISC÷e FILENAMEFINIT T÷e ÷e ÷i 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)÷e AUTHOR JM ÷e REFERENCE RAR tines÷e ÷e CLASSIFICATION D Random Access÷e DESCRIPTION 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 VARIABLES REFERENCED None÷e GLO BAL VARJABLJS AFFECTED Rmax% |c
P735 CEEFAX 735 Mon 10 Nov 21:22/25 |B2202204|b1vFInjtT|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÷esevjral records are in memory simul taneously, this cuts down on disc÷ettans 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
P735 CEEFAX 735 Mon 10 Nov 21:25/21 |B2203204|a16FInitT|i13BBC|l43908|s—:8 |pthj file hjadjr and held in last % and array lin*.÷eLast% can either bj t hj end of the file or it can bj 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",2)÷e 110 :÷e 120 END÷e 130 : ÷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÷ e20400 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$, len*÷e20460 REM Set up key to disp lay stored records÷e20470 *KEY5 F.i%|c
P735 CEEFAX 735 Mon 10 Nov 21:12/13 |B2204204|b1vFInjtT|j13BBC|l43C:4|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 EVDPROC÷e20540 :÷e 205k0 DEF PROCF#param(N$):LOCAL i%,x%,H$ ÷e20560 REM GLOBAL handle%,last%÷e20570 handle%=OPENIN N$÷e20580 INPUT£handle%,l ats%,H$÷e40590 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):MEX T÷e20620 ENDPROC÷i20630 :÷e|c
P735 CEEFAX 735 Mon 10 Nov 21:13/34 |B2201202|a16FBuild|j24BBBC332k|l43000|p ÷e 10RJM Build a new file÷e 20REM Fi le Name, Max number of records, No of fi elds per record, file#id÷e 30DATA test ,100,5,1÷e 40REM Length of fields. Qst Field is record number and must bj ling th 4÷e 50DATA 4,8,7,9,8÷e 60:÷e 70 RESTORE 30÷e 80PROCF#Build÷e 90END÷e 100:÷e20000REM *********************** ******÷e20010REM * *÷e20020REM * Random File Build *÷e40030REM * (c) 1986 J. Meets *÷e20040REM * Prestel Mailbox 70732 7277 *÷e20050REM * *÷e20060REM *********************** ******÷e20070:÷e40080DEF PROCF#Build÷e20 090LOCAL i%,max%,jld%,tic#lin%,file%,F$, H$,h$,R$÷e20100CLS÷e20110READ F$,max%,fl d%,file%÷e20120REM Now store field lengt hs as text header÷e20140H$="":rec#len%=0 ÷e20150FOR i%=1 TO jld%÷e20160READ h$:re c#len%=rec#len%+VAL(h$)÷e20170H$=H$+SIGH T$(" "+h$,2)÷e20180NEXT÷e40190REM Wr|c
P735 CEEFAX 735 Mon 10 Nov 21:08/15 |B2202202|a16FBuild|j24BBBC332k|l4334F|p ire the records to the file÷e20200x%=OPE NOUS F$÷e20210PRJNT£x%,1000*file%+max%,H $÷e20220FOR i%=0 TO max%÷e20230PRINTTAB( 10,10)i%:REM Show record number being wr itten÷e20240R$=STU$(file%*1000+i%)+TURIN G$(rec#len%-4,".")÷e20250PRINT£x%,R$÷e20 260NEXT÷e20270CLOSE£x%÷e20280ENDPROC÷e20 290:÷e|c