10 REM Music Information 15 REM Open or create the file 20 OPEN MusicDb, "MusicFile", Title 30 IF FSTAT <> 0 THEN CREATE MusicDb, "MusicFile", Title 100 REM Main Menu 110 PRINT "Music Database" 120 PRINT 130 PRINT "1) Add Title" 140 PRINT "2) Search Title" 150 PRINT "3) List All Titles" 160 PRINT 170 PRINT "Select 1-3, Q to Quit:" 180 INPUT selection$ 190 IF selection$ = "Q" THEN END 200 ON STRINGTONUMBER(selection$) GOSUB 2500,5000,7500 210 GOTO 110 1000 REM Display/Edit a frame in the variable editRecord 1010 PRINT "Music Record" 1020 PRINT 1030 PRINT "1) Title: "; editRecord.Title & "" 1040 PRINT "2) Group: "; editRecord.Group & "" 1050 PRINT "3) Running Time:"; editRecord.RunningTime & "" 1060 PRINT 1070 PRINT "Select 1-3 to edit, D when Done:" 1080 INPUT selection$ 1090 IF selection$ = "D" THEN RETURN 1100 ON STRINGTONUMBER(selection$) GOSUB 1200,1400,1600 1110 GOTO 1000 1200 REM edit the title 1210 PRINT "Enter Title [" & editRecord.Title & "]" 1220 INPUT title$ 1230 editRecord.Title := title$ 1240 RETURN 1400 REM edit the Group 1410 PRINT "Enter Group [" & editRecord.Group & "]" 1420 INPUT group$ 1430 editRecord.Group := group$ 1440 RETURN 1600 REM edit the running time 1610 PRINT "Enter RunningTime [" & editRecord.RunningTime & "]" 1620 INPUT runningTime 1630 editRecord.RunningTime := runningTime 1640 RETURN 2500 REM Add A New Record 2510 editRecord := {Title:nil, Group:nil, RunningTime:nil} 2520 GOSUB 1000 2530 GET MusicDb, checkRec, editRecord.Title 2540 IF FSTAT <> 0 THEN GOTO 2570 2550 PRINT "New record would overwrite existing record!" 2560 GOTO 5320 2570 PUT MusicDb, editRecord 2580 RETURN 5000 REM search for a record key, edit the matching record 5010 PRINT "Enter a Title, or press return for Main Menu" 5020 INPUT searchTitle$ 5030 IF searchTitle$ = "" THEN RETURN 5040 GET MusicDb, foundRec, searchTitle$ 5050 IF FSTAT <> 1 THEN GOTO 5060 5053 PRINT "Not found." 5056 GOTO 5000 5060 IF FSTAT = 2 THEN PRINT "Next Closest Record:" ELSE PRINT "Matching Record:" 5070 PRINT "Title: "; foundRec.Title; " Group: "; foundRec.Group 5080 PRINT "1) Edit Title" 5090 PRINT "2) Delete Title" 5100 PRINT 5110 PRINT "Select 1, 2, or R to Return to Search:" 5120 INPUT selection$ 5130 IF selection$ = "R" THEN GOTO 5000 5140 ON STRINGTONUMBER(selection$) GOSUB 5300,5500 5150 GOTO 5000 5300 REM edit record in foundRec 5310 editRecord = foundRec 5320 GOSUB 1000 5330 IF editRecord.Title = foundRec.Title THEN GOTO 5390 5340 GET MusicDb, checkRec, editRecord.Title 5350 IF FSTAT <> 0 THEN GOTO 5380 5360 PRINT "Edited record would overwrite existing record!" 5370 GOTO 5320 5380 DEL MusicDb, foundRec 5390 PUT MusicDb, editRecord 5400 RETURN 5500 REM delete record in foundRec 5510 DEL MusicDb, foundRec 5520 RETURN 7500 REM dump all records block 7510 GET MusicDb, foundRec, "" 7520 IF FSTAT = 1 THEN GOTO 7560 7530 PRINT "Title: "; foundRec.Title; " Group: "; foundRec.Group; " Time: "; foundRec.RunningTime 7540 GET MusicDb, foundRec 7550 GOTO 7520 7560 RETURN