10 ' ********************************************** 20 ' ********************************************** 30 ' *** K-TSERCH *** 40 ' *** PART OF A CLUB MEMBERSHIP *** 50 ' *** FILING SYSTEM CALLED KEEP-TRAK *** 60 ' *** *** 70 ' *** *** 80 ' *** WRITTEN IN MICROSOFT BASIC-80 REV.5.21 *** 90 ' *** *** 100 ' *** (C) COPYRIGHT 1983 BY HARVEY G. LORD *** 110 ' *** *** 120 ' *** DO NOT ATTEMPT TO RUN THIS PROGRAM *** 130 ' *** ALONE. IT IS CHAINED FROM K-TMENU. *** 140 ' ********************************************** 150 ' ********************************************** 160 ' 170 ON ERROR GOTO 20000 ' Error traps (Ch. 10) 180 COMMON CL$,RECORDTOTAL ' Pass variables (Ch. 11) 190 ' Define cursor control (Ch. 8) 200 DEF FNCUR$(VERT,HORZ) = CHR$(27)+CHR$(61)+CHR$(32+VERT)+CHR$(32+HORZ) 210 DEF FNCLLN$ = CHR$(27) + CHR$(84) ' Define clear line from cursor (Ch. 8) 220 ' 230 ' 240 ' 250 ' 260 ' 270 ' Check for B:K-T.LST's existence. If it's not there, to error trap 280 OPEN "I",#1,"B:K-T.LST":CLOSE#1 290 ' 300 ' 310 ' 320 ' 330 ' 340 ' The rest of the program's executed only if B:K-T.LST exists. 350 ' 360 PRINT CL$ ' Clear screen (Ch. 7) 370 PRINT:PRINT ' 2 blank lines 380 PRINT TAB(14);"*** Search Menu ***" 390 PRINT:PRINT ' 2 blank lines 400 PRINT "You may search for (and print, if you like) specific" 410 PRINT "members' names and addresses or print all members'" 420 PRINT "names and addresses on mailing labels." 430 PRINT:PRINT ' 2 blank lines 440 PRINT "Names are in the order they were entered, not alpha-" 450 PRINT "betical order. If you want a sorted list, return to" 460 PRINT "the MAIN MENU and press selection 4." 470 PRINT:PRINT ' 2 blank lines 480 PRINT TAB(11);"S - Search for specific entries" 490 PRINT TAB(11);"P - Print the whole mailing list" 500 PRINT TAB(11);"R - Return to MAIN MENU" 510 PRINT:PRINT:PRINT ' 3 blank lines 520 PRINT TAB(14);"Please choose by letter." 530 CHOICE$ = INKEY$:IF CHOICE$ = "" THEN 530 540 IF CHOICE$ = "S" OR CHOICE$ = "s" THEN 1000 550 IF CHOICE$ = "P" OR CHOICE$ = "p" THEN 2000 560 IF CHOICE$ = "R" OR CHOICE$ = "r" THEN PRINT:PRINT:GOTO 1170 570 ' 580 ' Catch illegal choices 590 ' 600 PRINT CHR$(7); ' Beep (Ch. 10) 610 FOR COUNT = 1 TO 3 ' Blink "Please choose" (Ch. 8) 620 PRINT FNCUR$(22,10);FNCLLN$ ' Clear line (Ch.8) 630 FOR PAUSE = 1 TO 100:NEXT PAUSE ' Count silently to 100 (Ch. 7) 640 PRINT FNCUR$(22,10);"Please press 'S,' 'P,' or 'R.'" 650 FOR PAUSE = 1 TO 100:NEXT PAUSE ' Count silently to 100 (Ch. 7) 660 NEXT COUNT 670 GOTO 530 680 ' 690 ' 700 ' 710 ' 720 ' 1000 ' Search B:K-T.LST for entries to print (Ch. 6) 1010 ' 1020 OPEN "I",#1,"B:K-T.LST" ' OPEN B:K-T.LST for reading (Ch. 3) 1030 GOSUB 4000 ' Enter name to search for 1040 IF EOF(1) THEN CLOSE#1:GOTO 1100 ' Check for end-of-file (Ch. 3) 1050 INPUT#1,FIRSTNM$,LASTNM$,STRTADD$,CITY$,STATE$,ZIP$,TELNUMBER$,PAID$ 1060 IF FIRSTNM$ <> FIRSTNAME$ OR LASTNM$ <> LASTNAME$ THEN 1040 1070 GOSUB 5000 ' Display record when found 1080 GOTO 1040 1090 ' 1100 ' Whole list has been checked 1110 ' 1120 GOSUB 6000 ' Ask if user wants to search for more 1130 IF CHOICE$ = "S" OR CHOICE$ = "s" THEN 1000 1140 ' 1150 ' If the user doesn't want to search more, return to MAIN MENU 1160 ' 1170 PRINT:PRINT ' 2 blank lines 1180 PRINT TAB(14);"Returning to MAIN MENU" 1190 CHAIN "K-TMENU",270 1200 ' 1210 ' 1220 ' 1230 ' 2000 ' Print whole membership list 2010 ' 2020 GOSUB 7000 ' Print whole list menu 2030 IF CHOICE$ = "R" OR CHOICE$ = "r" THEN 1170 2040 GOSUB 8000 ' Warning to plug in printer 2050 OPEN "I",#1,"B:K-T.LST" 2060 PRINT CL$ ' Clear screen (Ch. 7) 2070 IF EOF(1) THEN CLOSE#1:GOTO 2220 ' Check for End-of-file (Ch. 3) 2080 INPUT#1,FIRSTNM$,LASTNM$,STRTADD$,CITY$,STATE$,ZIP$,TELNUMBER$,PAID$ 2090 PRINT:PRINT:PRINT:PRINT ' 4 blank lines 2100 PRINT TAB(14);FIRSTNM$;" ";LASTNM$ ' Display the record 2110 PRINT TAB(14);STRTADD$ 2120 PRINT TAB(14);CITY$;", "STATE$;" ";ZIP$ 2130 PRINT TAB(14);"Phone No. ";TELNUMBER$ 2140 PRINT TAB(14);"Amount Paid: $";PAID$ 2150 PRINT:PRINT ' 2 blank lines 2160 ' Line 2170 uses the value of CHOICE$ returned from the subroutine in lines 7000 and following. 2170 IF CHOICE$ = "A" OR CHOICE$ = "a" THEN GOSUB 9000 ' Print this record? 2180 ' Line 2190 uses the value of CHOOSE$ returned from the subroutine in lines 9000 and following. 2190 IF CHOOSE$ = "N" OR CHOOSE$ = "n" THEN 2060 ' Don't print the record. 2200 GOSUB 3030 ' Send record to printer 2210 GOTO 2060 ' Loop back for next record 2220 PRINT:PRINT ' 2 blank lines 2230 PRINT TAB(14);"End of membership list." 2240 GOTO 1170 ' Return to MAIN MENU 2250 ' 2260 ' 2270 ' 2280 ' 2290 ' 3000 ' SUBROUTINE ** Print record found via search 3010 ' 3020 GOSUB 8030 ' Warning to plug in printer 3030 LPRINT FIRSTNM$;" ";LASTNM$ ' Send record to printer (mailing label format) 3040 LPRINT STRTADD$ 3050 LPRINT CITY$;", ";STATE$;" ";ZIP$ 3060 LPRINT:LPRINT:LPRINT 3070 RETURN 3080 ' 3090 ' 3100 ' 3110 ' 3120 ' 4000 ' SUBROUTINE ** Enter names to search for 4010 ' 4020 PRINT CL$ ' Clear screen (Ch. 7) 4030 PRINT TAB(7);"*** Search for and Specific Entries ***" 4040 PRINT 4050 PRINT " Enter the first and last names of the person" 4060 PRINT " whose address and telephone number you want to" 4070 PRINT " find." 4080 PRINT 4090 PRINT " NOTE: Spelling, including upper and lower case" 4100 PRINT " letters, COUNTS." 4110 PRINT 4120 PRINT " Misspelling causes computer errors." 4130 PRINT:PRINT ' 2 blank lines 4140 PRINT " FIRST NAME (then press RETURN):" 4150 PRINT " LAST NAME (then press RETURN):" 4160 PRINT FNCUR$(13,36);FNCLLN$ ' Clear line (Ch. 8) 4170 PRINT FNCUR$(13,36);:LINE INPUT;FIRSTNAME$ 4180 GOSUB 10000:IF ILLEGAL = 1 THEN 4160 ' Check for illegal entry (Ch. 10) 4190 PRINT FNCUR$(14,36);FNCLLN$ ' Clear line (Ch. 8) 4200 PRINT FNCUR$(14,36);:LINE INPUT;LASTNAME$ 4210 GOSUB 11000:IF ILLEGAL = 1 THEN 4190 ' Check for illegal entry (Ch. 10) 4220 PRINT FNCUR$(16,2);"Searching. Please wait." 4230 RETURN 4240 ' 4250 ' 4260 ' 4270 ' 4280 ' 5000 ' SUBROUTINE ** Display entry when found 5010 ' 5020 PRINT CL$ ' Clear screen (Ch. 7) 5030 PRINT " *** Here's the entry you asked for ***" 5040 PRINT:PRINT:PRINT:PRINT ' 4 blank lines 5050 PRINT TAB(14);FIRSTNM$;" ";LASTNM$ ' Display the record 5060 PRINT TAB(14);STRTADD$ 5070 PRINT TAB(14);CITY$;", "STATE$;" ";ZIP$ 5080 PRINT TAB(14);"Phone No. ";TELNUMBER$ 5090 PRINT TAB(14);"Amount Paid: $";PAID$ 5100 PRINT:PRINT ' 2 blank lines 5110 PRINT TAB(10);"Do you want to print this address 5120 PRINT TAB(8);"on a mailing label? Y = YES & N = NO" 5130 CHOICE$ = INKEY$:IF CHOICE$ = "" THEN 5130 5140 IF CHOICE$ = "Y" OR CHOICE$ = "y" THEN GOSUB 3000:RETURN 5150 IF CHOICE$ = "N" OR CHOICE$ = "n" THEN RETURN 5160 ' 5170 ' Catch illegal choices 5180 ' 5190 PRINT CHR$(7); ' Beep (Ch. 10) 5200 FOR COUNT = 1 TO 3 ' Blink "Please choose" (Ch. 8) 5210 PRINT FNCUR$(18,4);FNCLLN$ ' Clear line (Ch.8) 5220 FOR PAUSE = 1 TO 100:NEXT PAUSE ' Count silently to 100 (Ch. 7) 5230 PRINT FNCUR$(18,4);"Please press 'Y' for 'YES' or 'N' for 'NO.'" 5240 FOR PAUSE = 1 TO 100:NEXT PAUSE ' Count silently to 100 (Ch. 7) 5250 NEXT COUNT 5260 GOTO 5130 ' Try for correct response 5270 ' 5280 ' 5290 ' 5300 ' 5310 ' 6000 ' SUBROUTINE ** End of searching through list 6010 ' 6020 PRINT CL$ ' Clear screen (Ch. 7) 6030 PRINT:PRINT ' 2 blank lines 6040 PRINT TAB(14);"*** End of List ***" 6050 PRINT:PRINT ' 2 blank lines 6060 PRINT "I've searched through the whole list. If the name" 6070 PRINT "you wanted did not appear, either it's not in the" 6080 PRINT "list or you mistyped it." 6090 PRINT:PRINT ' 2 blank lines 6100 PRINT "Please remember that upper and lower case letters" 6110 PRINT "are different to a computer. If the name was ori-" 6120 PRINT "ginally entered with all capital letters and you" 6130 PRINT "just asked me to search with upper and lower case" 6140 PRINT "letters, I probably wouldn't find the entry." 6150 PRINT:PRINT:PRINT ' 2 blank lines 6160 PRINT TAB(12);"S - Search for another entry" 6170 PRINT TAB(12);"R - Return to MAIN MENU" 6180 PRINT:PRINT ' 2 blank lines 6190 PRINT TAB(14);"Please choose by letter." 6200 CHOICE$ = INKEY$:IF CHOICE$ = "" THEN 6200 ' Wait for keypress (Ch. 7) 6210 IF CHOICE$ = "S" OR CHOICE$ = "s" OR CHOICE$ = "R" OR CHOICE$ = "r" THEN RETURN 6220 ' 6230 ' Catch illegal choices 6240 ' 6250 PRINT CHR$(7); ' Beep (Ch. 10) 6260 FOR COUNT = 1 TO 3 ' Blink "Please choose" (Ch. 8) 6270 PRINT FNCUR$(22,13);FNCLLN$ ' Clear line (Ch.8) 6280 FOR PAUSE = 1 TO 100:NEXT PAUSE ' Count silently to 100 (Ch. 7) 6290 PRINT FNCUR$(22,13);"Please press 'S' or 'R.'" 6300 FOR PAUSE = 1 TO 100:NEXT PAUSE ' Count silently to 100 (Ch. 7) 6310 NEXT COUNT 6320 GOTO 6200 ' Try for correct response 6330 ' 6340 ' 6350 ' 6360 ' 6370 ' 7000 ' SUBROUTINE ** Print whole list menu 7010 ' 7020 PRINT CL$ ' Clear screen (Ch. 7) 7030 PRINT:PRINT ' 2 blank lines 7040 PRINT TAB(9);"** Print Whole Membership List **" 7050 PRINT:PRINT ' 2 blank lines 7060 PRINT "Do you want to stop for each member and give permis-" 7070 PRINT "sion to print the label or print labels for all mem-" 7080 PRINT "bers?" 7090 PRINT:PRINT ' 2 blank lines 7100 PRINT TAB(5);"A - Ask permission to print each label" 7110 PRINT TAB(5);"P - Print the whole list without stopping" 7120 PRINT TAB(5);"R - Return to MAIN MENU, printing nothing" 7130 PRINT:PRINT:PRINT ' 3 blank lines 7140 PRINT TAB(14);"Please choose by letter." 7150 CHOICE$ = INKEY$:IF CHOICE$ = "" THEN 7150 7160 IF CHOICE$ = "A" OR CHOICE$ = "a" THEN RETURN ' Main program uses CHOICE$'s value 7170 IF CHOICE$ = "P" OR CHOICE$ = "p" THEN RETURN 7180 IF CHOICE$ = "R" OR CHOICE$ = "r" THEN RETURN ' Return to MAIN MENU 7190 ' 7200 ' Catch illegal choices 7210 ' 7220 PRINT CHR$(7); ' Beep (Ch. 10) 7230 FOR COUNT = 1 TO 3 ' Blink "Please choose" (Ch. 8) 7240 PRINT FNCUR$(17,11);FNCLLN$ ' Clear line (Ch.8) 7250 FOR PAUSE = 1 TO 100:NEXT PAUSE ' Count silently to 100 (Ch. 7) 7260 PRINT FNCUR$(17,11);"Please press 'A,' 'P,' or 'R.'" 7270 FOR PAUSE = 1 TO 100:NEXT PAUSE ' Count silently to 100 (Ch. 7) 7280 NEXT COUNT 7290 GOTO 7150 ' Try for correct response 7300 ' 7310 ' 7320 ' 7330 ' 7340 ' 8000 ' SUBROUTINE ** Warning to plug in the printer 8010 ' 8020 PRINT CL$ ' Clear screen (Ch. 7) 8030 PRINT:PRINT:PRINT:PRINT:PRINT:PRINT:PRINT TAB(4);"Your printer must be plugged in, turned on" 8040 PRINT TAB(7);"and loaded with 3-1/2 X 15/16 labels." 8050 PRINT:PRINT:PRINT:PRINT TAB(7);"Press any key when the printer's ready." 8060 IF INKEY$ = "" THEN 8060 ' Wait for keypress (Ch. 7) 8070 RETURN 8080 ' 8090 ' 8100 ' 8110 ' 8120 ' 9000 ' SUBROUTINE ** Do you want to print this record? 9010 ' 9020 PRINT:PRINT ' 2 blank lines 9030 PRINT TAB(6);"Do you want to print this entry? (Y/N)" 9040 CHOOSE$ = INKEY$:IF CHOOSE$ = "" THEN 9040 ' Wait for keypress (Ch. 7) 9050 IF CHOOSE$ = "Y" OR CHOOSE$ = "y" OR CHOOSE$ = "N" OR CHOOSE$ = "n" THEN RETURN 9060 ' 9070 ' Catch illegal choices 9080 ' 9090 PRINT CHR$(7); ' Beep (Ch. 10) 9100 FOR COUNT = 1 TO 3 ' Blink "Please choose" (Ch. 8) 9110 PRINT FNCUR$(18,4);FNCLLN$ ' Clear line (Ch.8) 9120 FOR PAUSE = 1 TO 100:NEXT PAUSE ' Count silently to 100 (Ch. 7) 9130 PRINT FNCUR$(18,4);"Please press 'Y' for 'YES' or 'N' for 'NO.'" 9140 FOR PAUSE = 1 TO 100:NEXT PAUSE ' Count silently to 100 (Ch. 7) 9150 NEXT COUNT 9160 GOTO 9040 ' Try for correct response 9170 ' 9180 ' 9190 ' 9200 ' 9210 ' 10000 ' SUBROUTINE ** Prevent illegal FIRSTNAME$ entries (Ch. 10) 10010 ' 10020 ILLEGAL = 0 ' No illegal entry yet, just checking (Ch. 10) 10030 IF FIRSTNAME$ = "" THEN FIRSTNAME$ = "N/A":GOTO 10220 10040 FOR CHECK = 1 TO LEN(FIRSTNAME$) ' Legal entries on next line 10050 IF ASC(MID$(FIRSTNAME$,CHECK,1)) >= 65 AND ASC(MID$(FIRSTNAME$,CHECK,1)) <= 90 THEN 10210 ' A through Z 10060 IF ASC(MID$(FIRSTNAME$,CHECK,1)) >= 97 AND ASC(MID$(FIRSTNAME$,CHECK,1)) <= 122 THEN 10210 ' a through z 10070 IF ASC(MID$(FIRSTNAME$,CHECK,1)) = 32 OR ASC(MID$(FIRSTNAME$,CHECK,1)) = 38 OR ASC(MID$(FIRSTNAME$,CHECK,1)) = 39 THEN 10210 ' Space apostrophe, & ampersand 10080 IF ASC(MID$(FIRSTNAME$,CHECK,1)) >= 45 AND ASC(MID$(FIRSTNAME$,CHECK,1)) <= 46 THEN 10210 ' Dash & period 10090 ILLEGAL = 1 ' ILlegal entry found (Ch. 10) 10100 PRINT CHR$(7) ' Beep (Ch. 10) 10110 PRINT FNCUR$(3,0);FNCLLN$ ' Clear third line from top 10120 PRINT FNCUR$(5,0);FNCLLN$ ' Clear fifth line from top 10130 FOR COUNT = 1 TO 3 ' Bink error message 10140 PRINT FNCUR$(4,0);FNCLLN$ ' Clear fourth line from top 10150 FOR PAUSE = 1 TO 100:NEXT PAUSE ' Count to 100 silently (Ch. 7) 10160 PRINT FNCUR$(4,18);"Illegal Entry!" 10170 FOR PAUSE = 1 TO 100:NEXT PAUSE ' Count to 100 silently (Ch. 7) 10180 NEXT COUNT 10190 PRINT FNCUR$(5,2);"Please re-enter without digits or punctuation." 10200 RETURN ' Go back to correct entry 10210 NEXT CHECK 10220 GOSUB 12000 ' Replace INPUT instructions once illegal INPUT's corrected 10230 RETURN ' No illegal entries, next INPUT 10240 ' 10250 ' 10260 ' 10270 ' 10280 ' 11000 ' SUBROUTINE ** Prevent illegal LASTNAME$ entries (Ch. 10) 11010 ' 11020 ILLEGAL = 0 ' No illegal entry yet, just checking (Ch. 10) 11030 IF LASTNAME$ = "" THEN LASTNAME$ = "N/A":GOTO 10220 11040 FOR CHECK = 1 TO LEN(LASTNAME$) ' Legal entries on next line 11050 IF ASC(MID$(LASTNAME$,CHECK,1)) >= 65 AND ASC(MID$(LASTNAME$,CHECK,1)) <= 90 THEN 11210 ' A through Z 11060 IF ASC(MID$(LASTNAME$,CHECK,1)) >= 97 AND ASC(MID$(LASTNAME$,CHECK,1)) <= 122 THEN 11210 ' a through z 11070 IF ASC(MID$(LASTNAME$,CHECK,1)) = 32 OR ASC(MID$(LASTNAME$,CHECK,1)) = 38 OR ASC(MID$(LASTNAME$,CHECK,1)) = 39 THEN 11210 ' Space apostrophe, & ampersand 11080 IF ASC(MID$(LASTNAME$,CHECK,1)) >= 45 AND ASC(MID$(LASTNAME$,CHECK,1)) <= 46 THEN 11210 ' Dash & period 11090 ILLEGAL = 1 ' ILlegal entry found (Ch. 10) 11100 PRINT CHR$(7) ' Beep (Ch. 10) 11110 PRINT FNCUR$(3,0);FNCLLN$ ' Clear third line from top 11120 PRINT FNCUR$(5,0);FNCLLN$ ' Clear fifth line from top 11130 FOR COUNT = 1 TO 3 ' Bink error message 11140 PRINT FNCUR$(4,0);FNCLLN$ ' Clear fourth line from top 11150 FOR PAUSE = 1 TO 100:NEXT PAUSE ' Count to 100 silently (Ch. 7) 11160 PRINT FNCUR$(4,18);"Illegal Entry!" 11170 FOR PAUSE = 1 TO 100:NEXT PAUSE ' Count to 100 silently (Ch. 7) 11180 NEXT COUNT 11190 PRINT FNCUR$(5,2);"Please re-enter without digits or punctuation." 11200 RETURN ' Go back to correct entry 11210 NEXT CHECK 11220 GOSUB 12000 ' Replace INPUT instructions once illegal INPUT's corrected 11230 RETURN ' No illegal entries 11240 ' 11250 ' 11260 ' 11270 ' 11280 ' 12000 ' SUBROUTINE ** Replace INPUT instructions after illegal INPUT's corrected 12010 ' 12020 PRINT FNCUR$(3,0);" Enter the first and last names of the person" 12030 PRINT " whose address and telephone number you want to" 12040 PRINT FNCLLN$;" find." 12050 RETURN 12060 ' 12070 ' 12080 ' 12090 ' 12100 ' 20000 ' ** Error Traps ** (Ch. 10) 20010 ' 20020 IF ERR <> 53 AND ERL <> 280 THEN 20220 ' Trap File not Found in line 280 (Ch. 10) 20030 PRINT CHR$(7) ' Beep (Ch. 10) 20040 PRINT CL$ ' Clear screen (Ch. 7) 20050 PRINT 20060 PRINT TAB(17);"*** Error ***" 20070 PRINT:PRINT:PRINT:PRINT ' 4 blank lines 20080 PRINT "There is no membership list on the diskette in B:." 20090 PRINT:PRINT:PRINT:PRINT ' 4 blank lines 20100 PRINT TAB(5);"You can't search through or print a list" 20110 PRINT TAB(15);"that doesn't exist." 20120 PRINT:PRINT:PRINT:PRINT ' 4 blank lines 20130 PRINT "Please press any key to return to the MAIN MENU." 20140 IF INKEY$ = "" THEN 20140 ' Wait for keypress (Ch. 7) 20150 RESUME 1170 ' Return to MAIN MENU 20160 ' 20170 ' 20180 ' 20190 ' 20200 ' 20210 ' 20220 ' Catch-all Error Trap (Ch. 10) 20230 ' 20240 PRINT CHR$(7) ' Beep (Ch. 10) 20250 PRINT CL$ ' Clear screen (Ch. 7) 20260 PRINT:PRINT ' 2 blank lines 20270 PRINT "You have generated error number";ERR 20280 PRINT "on line number";ERL;"." 20290 PRINT 20300 PRINT "Please write this fact down. Also write down ex-" 20310 PRINT "actly what you did before this error took place." 20320 PRINT 20330 PRINT "Ask a BASIC programmer what the error means and" 20340 PRINT "how to correct it." 20350 PRINT:PRINT ' 2 blank lines 20360 PRINT "Please press any key to return to the MAIN MENU." 20370 IF INKEY$ = "" THEN 20370 ' Waiting for keypress (Ch. 7) 20380 RESUME 1170 ' Return to MAIN MENU