Public domain data base for the 2068.
Appears on
Capital Area Timex Sinclair User Group’s Library Tape.
Source Code
10 REM "THIS IS A PROGRAM THAT WAS PRINTED IN THE MARCH ISSUE OF MICROCOMPUTING FOR THE ZX 1000. IT HAS BEEN CONVERTED FOR USE ON THE 2068" 100 REM A LISTS PROGRAM FOR THE 2068 200 REM MAIN MENU 210 CLS 215 BORDER 2: BRIGHT 1 220 PRINT TAB 7;"THE LISTS PROGRAM" 230 PRINT 240 PRINT "1..ADD RECORD" 250 PRINT 260 PRINT "2..CHANGE RECORD" 270 PRINT 280 PRINT "3..DELETE RECORD" 290 PRINT 300 PRINT "4..LIST ALL RECORDS" 310 PRINT 320 PRINT "5..SEARCH FOR A RECORD" 330 PRINT 340 PRINT "6..SORT RECORDS" 350 PRINT 360 PRINT "7..SAVE RECORDS TO TAPE" 370 PRINT 380 PRINT "8..SET UP NEW FILE" 390 PRINT 395 PRINT "9..LIST FIELDS" 400 PRINT 410 PRINT 500 PRINT "WHICH DO YOU WISH TO DO?"; 510 INPUT A 515 LET A=INT A 520 IF A>0 AND A<10 THEN GO TO 560 530 CLS 540 PRINT "PLEASE CHOSE 1-9" 550 GO TO 230 560 CLS 570 GO SUB A*1000 580 GO TO 210 1000 REM ADD RECORDS 1010 LET N=N+1 1015 PRINT 1020 PRINT "RECORD NUMBER ";N 1030 IF N<=M THEN GO TO 1060 1032 LET N=M 1035 PRINT 1040 PRINT "NO MORE RECORDS CAN BE ADDED" 1050 GO TO 1920 1060 FOR I=1 TO N1 1070 PRINT 1080 PRINT N$(I); 1090 INPUT I$(N,D(I,1) TO D(I,2)) 1095 PRINT I$(N,D(I,1) TO D(I,2)); 1100 PRINT 1110 NEXT I 1120 PRINT 1130 PRINT "CHANGE ANYTHING?"; 1140 INPUT A$ 1145 PRINT 1150 IF A$(1)="Y" THEN GO TO 1060 1160 PRINT 1170 PRINT "RECORD ";N;" ADDED" 1180 PRINT 1900 PRINT "ADD MORE RECORDS?"; 1910 INPUT A$ 1920 PRINT 1930 IF A$(1)="Y" THEN CLS : GO TO 1000 1950 RETURN 2000 REM CHANGE A RECORD 2010 PRINT 2011 PRINT 2020 PRINT "TO CHANGE A RECORD, YOU MUST",,," ENTER THE RECORD NUMBER FOR",,," THAT RECORD. DO YOU WISH TO",,,"SEARCH FOR THE RECORD NUMBER?"; 2090 INPUT A$ 2095 PRINT 2100 IF A$(1)="Y" THEN GO SUB 5000 2110 CLS 2120 PRINT 2130 PRINT "RECORD NUMBER TO CHANGE: "; 2140 INPUT A 2145 LET A=INT A 2150 PRINT 2160 IF A>0 AND A<=N THEN GO TO 2200 2170 PRINT "INVALID RECORD NUMBER" 2180 GO TO 2900 2200 FOR I=1 TO N1 2210 PRINT 2220 PRINT N$(I);I$(A,D(I,1) TO D(I,2)) 2230 PRINT 2240 PRINT TAB 10;"CHANGE?"; 2250 INPUT A$ 2255 PRINT 2260 IF A$(1)<>"Y" THEN GO TO 2300 2270 PRINT N$(I); 2280 INPUT I$(A,D(I,1) TO D(I,2)) 2285 PRINT I$(A,D(I,1) TO D(I,2)) 2290 PRINT 2300 NEXT I 2800 PRINT 2810 PRINT "FINISHED WITH RECORD ";A 2900 PRINT 2910 PRINT "CHANGE OTHER RECORDS?"; 2920 INPUT A$ 2930 PRINT 2940 IF A$(1)="Y" THEN GO TO 2000 2950 RETURN 3000 REM DELETE A RECORD 3010 IF N>0 THEN GO TO 3060 3020 PRINT 3030 PRINT "NO RECORDS IN FILE" 3040 GO TO 3330 3060 PRINT 3070 PRINT "ITEMS ARE DELETED BY RECORD" 3080 PRINT 3090 PRINT "NUMBER. RECORD NUMBERS MAY",,,"CHANGE AFTER ITEM IS DELETED" 3120 PRINT 3130 PRINT "DO YOU WISH TO SEARCH FOR THE",,,"RECORD?"; 3140 INPUT A$ 3150 PRINT 3160 IF A$(1)="Y" THEN GO SUB 5000 3170 PRINT 3180 PRINT "RECORD NUMBER TO DELETE:"; 3190 INPUT A 3195 LET A=INT A 3200 IF A>0 AND A<=N THEN GO TO 3250 3210 PRINT 3220 PRINT "INVALID RECORD NUMBER" 3230 GO TO 3900 3250 FOR I=1 TO N1 3260 PRINT 3270 PRINT N$(I);I$(A,D(I,1) TO D(I,2)) 3280 NEXT I 3290 PRINT 3300 PRINT "DELETE THIS RECORD?"; 3310 INPUT A$ 3320 IF A$(1)="Y" THEN GO TO 3360 3330 PRINT 3340 PRINT "DELETE CANCELLED" 3350 GO TO 3900 3360 IF A=N THEN GO TO 3450 3405 FOR I=A TO N-1 3410 LET I$(I)=I$(I+1) 3420 NEXT I 3450 LET N=N-1 3460 PRINT 3470 PRINT "RECORD DELETED" 3900 PRINT 3910 PRINT "DELETE ANY OTHER RECORDS?"; 3920 INPUT A$ 3930 PRINT 3940 IF A$(1)="Y" THEN GO TO 3010 3950 RETURN 4000 REM LIST RECORDS 4010 PRINT 4015 LET A=0 4020 PRINT "PRINT ALL RECORD FIELDS?"; 4030 INPUT A$ 4040 IF A$(1)="Y" THEN LET A=1 4045 PRINT 4060 FOR I=1 TO N1 4070 LET A(I)=A 4075 IF A=1 THEN LET A(I)=I 4080 NEXT I 4095 LET J=N1 4100 IF A=1 THEN GO TO 4220 4110 PRINT 4120 PRINT "ENTER Y FOR EACH FIELD",,,"YOU WANT PRINTED:" 4125 LET J=0 4130 PRINT 4140 FOR I=1 TO N1 4150 PRINT 4160 PRINT N$(I);" ?"; 4170 INPUT A$ 4175 PRINT A$(1) 4180 IF A$(1)<>"Y" THEN GO TO 4210 4190 LET J=J+1 4200 LET A(J)=I 4210 NEXT I 4220 PRINT 4230 PRINT "PRINT TO SCREEN OR PRINTER(S/P)" 4240 INPUT A$ 4250 IF A$(1)="P" THEN GO TO 4600 4300 PRINT 4310 PRINT TAB 10; PAPER 5;" ";L$;" "; "LIST" 4330 FOR I=1 TO N 4340 FOR K=1 TO J 4350 PRINT 4360 PRINT N$(A(K));I$(I,D(A(K),1) TO D(A(K),2)) 4370 NEXT K 4390 NEXT I 4400 GO TO 4900 4610 LPRINT TAB 5;L$;" LIST" 4620 LPRINT 4660 LPRINT N$(A(K));I$(I,D(A(K),1) TO D(A(K),2)) 4670 NEXT K 4680 LPRINT 4690 NEXT I 4900 PRINT 4910 PRINT "ANOTHER LIST?"; 4920 INPUT A$ 4930 IF A$(1)="Y" THEN GO TO 4000 4950 RETURN 5000 REM SEARCH FOR RECORD 5010 PRINT 5020 PRINT "WHICH FIELD TO SEARCH ON:" 5030 FOR I=1 TO N1 5040 PRINT 5050 PRINT N$(I);" ?" 5060 INPUT A$ 5070 IF A$(1)="Y" THEN GO TO 5100 5080 NEXT I 5085 PRINT 5090 PRINT "SELECTION CANCELLED" 5095 GO TO 5900 5100 PRINT 5110 PRINT "ENTER THE SEARCH STRING"; 5120 INPUT A$ 5122 LET A=LEN A$ 5125 IF A<1 THEN GO TO 5110 5126 IF A<=(D(1,2)-D(I,1)+1) THEN GO TO 5129 5127 LET A=(D(I,2)-D(I,1)+1) 5128 LET A$=A$(1 TO A) 5129 LET A=A-1+D(I,1) 5130 LET F=0 5140 LET Q=0 5160 FOR J=1 TO N 5170 IF A$=I$(J,D(I,1) TO A) THEN GO SUB 5500 5180 IF Q=1 THEN GO TO 5200 5190 NEXT J 5210 PRINT 5220 PRINT "SEARCH COMPLETE" 5230 PRINT 5240 IF F=0 THEN PRINT "RECORD NOT FOUND" 5250 GO TO 5900 5500 PRINT 5505 PRINT "RECORD NUMBER ";J 5510 FOR K=1 TO N1 5520 PRINT 5530 PRINT N$(K);I$(J,D(K,1) TO D(K,2)) 5540 NEXT K 5550 PRINT 5560 PRINT "CONTINUE SEARCH?"; 5570 INPUT B$ 5580 IF B$(1)="N" THEN LET Q=1 5590 LET F=1 5600 RETURN 5900 PRINT 5910 PRINT "ANOTHER SEARCH?"; 5920 INPUT A$ 5930 IF A$(1)="Y" THEN GO TO 5000 5950 RETURN 6000 REM BUBBLE SORT RECORDS 6010 PRINT 6020 PRINT "SORTING TIME DEPENDS ON ",,,"NUMBER OF RECORDS" 6030 PRINT 6040 PRINT "WHICH FIELD TO SORT BY:" 6050 PRINT 6060 FOR I=1 TO N1 6070 PRINT 6080 PRINT N$(I);" ?"; 6090 INPUT A$ 6100 IF A$(1)="Y" THEN GO TO 6150 6110 NEXT I 6120 PRINT 6130 PRINT "SORT CANCELLED" 6140 GO TO 6900 6150 PRINT 6170 FOR J=1 TO N-1 6180 FOR K=J TO N 6190 IF I$(J,D(I,1) TO D(I,2))<=I$(K,D(I,1) TO D(I,2)) THEN GO TO 6250 6200 LET B$=I$(J) 6210 LET I$(J)=I$(K) 6220 LET I$(K)=B$ 6250 NEXT K 6260 NEXT J 6280 PRINT 6290 PRINT "SORT COMPLETE" 6900 PRINT 6910 PRINT "SORT ON ANOTHER FIELD?"; 6920 INPUT A$ 6925 PRINT 6930 IF A$(1)="Y" THEN GO TO 6000 6950 RETURN 7000 REM SAVE PROGRAM TO TAPE 7010 PRINT 7020 PRINT "PUT CASSETTE IN TAPE RECORDER",,,"BEGIN RECORDING, THEN",,,"PRESS ANY KEY TO SAVE LIST"; 7050 IF INKEY$="" THEN GO TO 7050 7060 PRINT 7070 SAVE L$ 7900 GO TO 100 8000 REM SET UP NEW LIST 8020 PRINT "WHAT LIST NAME TO USE?"; 8030 INPUT L$ 8035 PRINT TAB 10; PAPER 5;"**";L$;"**" 8040 PRINT 8045 PRINT "HOW MANY RECORD FIELDS ? ": INPUT N1 8050 PRINT TAB 10; PAPER 5;" ";N1;" " 8070 PRINT 8080 LET K=15 8090 PRINT "ENTER MAX. NUMBER OF CHARACTERS IN DESCRIPTIONS +1 (LIMIT 15)"; 8120 INPUT K 8125 PRINT TAB 10; PAPER 5;" ";K;" " 8130 IF K>15 THEN LET K=15 8135 IF K<0 THEN LET K=0 8140 PRINT 8150 LET L=31-K 8160 PRINT "MAXIMUM SIZE OF DATA FIELD IS";TAB 10; PAPER 5;" ";L;" "; PAPER 7;" CHARACTERS" 8182 DIM N$(N1,K) 8184 DIM A(N1) 8186 DIM D(N1,2) 8190 PRINT 8195 PRINT 8200 PRINT "NOW ENTER FIELD DESCRIPTIONS","AND FIELD LENGTHS:"; 8225 LET J=1 8230 PRINT 8240 FOR I=1 TO N1 8250 PRINT 8255 LET A$="" 8260 PRINT "FIELD ";I;":"; 8270 INPUT A$ 8272 PRINT TAB 15; PAPER 5;" ";A$;" " 8275 LET A$=A$+" " 8280 LET N$(I)=A$ 8290 PRINT 8300 PRINT "FIELD LENGTH (1-";L;"):"; 8310 INPUT A 8312 IF A<1 THEN LET A=1 8315 IF A>L THEN LET A=L 8317 PRINT TAB 25; PAPER 5;" ";A;" " 8320 LET D(I,1)=J 8330 LET J=J+A 8335 LET D(I,2)=J-1 8340 PRINT 8350 NEXT I 8360 LET J=J-1 8370 LET N=0 8380 LET M=INT ((27000-N1*(31-L+12))/J) 8390 PRINT 8400 PRINT "MAXIMUM NUMBER OF RECORDS",,,"POSSIBLE IS ABOUT ";M 8430 PRINT 8432 PRINT "MEMORY FREE "; 8433 PRINT ~ 8434 PRINT 8435 PRINT "HOW MANY RECORDS DO YOU WANT?"; 8437 INPUT A 8439 LET A=INT A 8440 IF A>0 AND A<M THEN LET M=A 8450 DIM I$(M,J) 8900 PRINT 8910 PRINT L$;" LIST SET UP" 8920 PRINT 8930 PRINT "PRESS ANY KEY TO RETURN TO MENU" 8940 IF INKEY$="" THEN GO TO 8940 8950 RETURN 9000 REM LIST FIELDS 9020 PRINT 9030 PRINT TAB 5;L$;" LIST FIELDS" 9040 PRINT 9050 FOR I=1 TO N1 9060 PRINT 9065 PRINT 9070 PRINT N$(I) 9080 NEXT I 9090 PRINT 9100 PRINT "PRESS ANY KEY TO RETURN TO MENU"; 9105 PRINT 9110 IF INKEY$="" THEN GO TO 9110 9900 RETURN