120 PRINT"Look up a record......................................................Depress L":PRINT
130 PRINT"Scan all records......................................................Depress S":PRINT
140 PRINT"Update a record.......................................................Depress U":PRINT
150 PRINT"Delete a record.......................................................Depress D":PRINT
160 PRINT"Exit this program.....................................................Depress X":PRINT
170 PRINT"Initialize the file...................................................Depress I":PRINT
180 GET 2,1:PRINT:PRINT TAB(18);"CURRENT NUMBER OF RECORDS ON FILE =";CVI(KP$)-1;:IF CVI(KP$)<1 THEN COLOR 0,7:PRINT"PLEASE INITIALIZE!":COLOR 7,0:PRINT:ELSE PRINT:PRINT
185 PRINT"Please depress the key corresponding to your choice."
1000 CLS
1005 FC=FC+1
10000 '
10010 GOSUB 27000
10200 GOSUB 28000
10800 GOSUB 29000
11000 '
11010 GOSUB 27000
11200 GOSUB 28000
11800 GOSUB 29000
11810 UF$="":LOCATE 25,1:PRINT"Which field number do you want to update? ";
11820 UX$=INPUT$(1):IF UX$>="0" AND UX$<="9" THEN PRINT UX$;:UF$=UF$+UX$:GOTO 11820:ELSE IF UX$=CHR$(8) THEN PRINT UX$;:UF$=LEFT$(UF$,LEN(UF$)-1):GOTO 11820:ELSE IF UX$<>CHR$(13) THEN 11820:ELSE UF=VAL(UF$)
11900 '
12000 '
12010 GOSUB 27000
12200 GOSUB 28000
12800 GOSUB 29000
22000 '
25000 IF ERR=6 THEN RESUME NEXT:ELSE IF ERR=5 AND (ERL>35000 AND ERL<36000) THEN RESUME 35000
25001 IF ERR=62 THEN LOCATE 25,1:COLOR 7,0:PRINT"YOU DIDN'T INITIALIZE YOUR KEY FILE! DO SO!";:COLOR 0,7:BEEP:FOR I=1 TO 2000:NEXT:CLOSE:RUN:ELSE X=CSRLIN:Y=POS(9)
25010 LOCATE 24,1:COLOR 23,0:PRINT"ERROR ENCOUNTERED IN LINE";ERL;:COLOR 7,0
25015 IF ERR=10 THEN PRINT"Number too large for field type.":LOCATE X,Y:RESUME NEXT
25020 IF ERL<10000 AND ERL>1000 THEN PRINT"Probable error in edit specifications.":PRINT"Error number is";ERR;". Please correct the syntax in line";ERL
25030 CLOSE:END
26000 FOR ZZ=1 TO LEN(ZZ$)
26010 SP=ASC(MID$(ZZ$,ZZ,1)):X#=X#+ZZ*(SP+1/SP)
26020 NEXT
26030 IF X#<1E+17 THEN X#=X#*X#:GOTO 26030
26035 SP=ASC(ZZ$)+ASC(RIGHT$(ZZ$,1)):SP=SP MOD 10:SP=SP+4:X$=STR$(X#):RP=VAL(MID$(X$,SP,4)):X#=0
27000 '
27020 '
27030 ZZ$=KF$:GOSUB 26000:KP=RP
28998 RETURN
29000 CLS:CL=CSRLIN
29020 READ R$:CX=LEN(G$(I))
29021 WHILE (LEN(G$(I))>10 AND MID$(G$(I),CX,1)<=" " AND CX>10):CX=CX-1:WEND
29022 IF CX<LEN(G$(I)) THEN G$(I)=LEFT$(G$(I),CX)
29024 LC=POS(0):IF LC<5 THEN PRINT"#";I;:COLOR 0,7:PRINT R$;:COLOR 7,0:PRINT G$(I);:GOTO 29030
29025 CL=CSRLIN:IF CL>22 THEN GOSUB 41010:GOTO 29024
29026 IF (LC<40 AND LEN(R$)+LEN(G$(I))+36<80) THEN PRINT TAB(40);"#";I;:COLOR 0,7:PRINT R$;:COLOR 7,0:PRINT G$(I);:ELSE PRINT:GOTO 29024
29030 NEXT:RESTORE:PRINT
29930 IF AN$="S" THEN RETURN
29940 LOCATE 25,1:PRINT STRING$(79,32);:LOCATE 25,1:PRINT"Is this the record? Depress Y if so, any other if not.";
30000 CD=INSTR(CD$,CHR$(32)):IF CD>1 THEN CD$=LEFT$(CD$,CD-1)+MID$(CD$,CD+1):GOTO 30000:ELSE IF CD=1 THEN CD$=MID$(CD$,2):GOTO 30000
30005 FOR ZZ=1 TO LEN(CD$)
30010 IF MID$(CD$,ZZ,1)<"0" OR MID$(CD$,ZZ,1)>"9" THEN IF MID$(CD$,ZZ,1)<>"." AND MID$(CD$,ZZ,1)<>"-" THEN E=1
30020 NEXT:IF E THEN RETURN
30030 CD=INSTR(CD$,"-"):IF CD>0 AND INSTR(CD+1,CD$,"-")>0 THEN E=1:RETURN:ELSE IF (CD>0 AND CD<>1) THEN E=1:RETURN
30040 CD=INSTR(CD$,"."):IF CD>0 AND INSTR(CD+1,CD$,".")>0 THEN E=1:RETURN
30050 RETURN
31000 FOR ZZ=1 TO LEN(CD$)
31010 IF MID$(CD$,ZZ,1)<="9" AND MID$(CD$,ZZ,1)>="0" THEN E=1
31020 NEXT
31030 RETURN
32000 '
32010 PRINT TAB(13);:COLOR 0,7:PRINT"This will erase all previous data, if any!":COLOR 7,0:PRINT TAB(13);"To continue initialization, depress the C key. ";
32030 AN$=INPUT$(1):IF AN$<>"C" THEN CLOSE:RUN
32035 CLS:PRINT"This will take a little time. Please be patient.":LOCATE 4,10:PRINT"INITIALIZING THROUGH RECORD"