10 ' ********************************************** 20 ' ********************************************** 30 ' *** K-TMAKE *** 40 ' *** PART OF A CLUB MEMBERSHIP FILING *** 50 ' *** 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-T MENU. *** 140 ' ********************************************** 150 ' ********************************************** 160 ' 170 ON ERROR GOTO 20000 ' Error traps (Ch. 10) 180 COMMON CL$,RECORDTOTAL ' Pass variables to programs (Ch. 11) 190 DIM MEMBER$(8) ' Dimension MEMBER$ array (Ch. 12) 200 ' Define cursor control (Ch. 8) 210 DEF FNCUR$(V,H) = CHR$(27)+CHR$(61)+CHR$(32+V)+CHR$(32+H) 220 DEF FNBIN$ = CHR$(27)+CHR$(41) ' Define begin lowered intensity (Ch. 8) 230 DEF FNNIN$ = CHR$(27)+CHR$(40) ' Define end lowered intensity (Ch. 8) 240 DEF FNCLLN$ = CHR$(27) + CHR$(84) ' Define clear line from cursor (Ch. 8) 250 ' 260 ' 270 ' 280 ' 290 ' 300 ' Check for B:K-T.LST's existence. If it's not there, to error trap; 310 OPEN "I",#1,"B:K-T.LST" ' if it is there, give opportunity 320 ' to add to it or erase it. (Ch. 10) 330 ' 340 ' 350 ' 360 ' 370 ' Lines 380-670 are executed ONLY if B:K-T.LST already exists. 380 CLOSE#1 390 PRINT CL$ ' Clear screen (Ch. 7) 400 PRINT TAB(15);"*** NOTE ***" 410 PRINT 420 PRINT "The club list on the B: disk includes";RECORDTOTAL;"members." 430 PRINT 440 PRINT "WARNING: creating a new membership list erases the" 450 PRINT "old one. Be *SURE* you don't need the list on B:" 460 PRINT "before wiping it out." 470 PRINT 480 PRINT TAB(10);"A - Add to existing club list" 490 PRINT TAB(10);"K - Kill old list & make new one" 500 PRINT TAB(10);"R - Return to MAIN MENU" 510 PRINT:PRINT ' 2 blank lines 520 PRINT TAB(5);"Please choose A(dd), K(ill), or R(eturn)." 530 CHOICE$ = INKEY$:IF CHOICE$ = "" THEN 530 ' Wait for keypress (Ch 7) 540 IF CHOICE$ = "A" OR CHOICE$ = "a" THEN PRINT:PRINT TAB(7);"Saving membership list. Please wait.":GOTO 1000 ' Add new members 550 IF CHOICE$ = "K" OR CHOICE$ = "k" THEN 2000 ' Make new list 560 IF CHOICE$ = "R" OR CHOICE$ = "r" THEN 1270 ' To K-TMENU, line 270 (Ch. 11) 570 ' 580 ' Catch illegal menu choices 590 ' 600 PRINT CHR$(7) ' Beeper (Ch. 10) 610 FOR COUNT = 1 TO 3 ' Blink "Please choose" (Ch. 8) 620 PRINT FNCUR$(14,4);FNCLLN$ ' Clear line (line indentation Ch. 11) 630 FOR PAUSE = 1 TO 100:NEXT PAUSE ' Count to 100 silently (Ch. 8) 640 PRINT FNCUR$(14,9);"Please choose 'A', 'K', or 'R'." 650 FOR PAUSE = 1 TO 100:NEXT PAUSE ' Count to 100 silently (Ch. 8) 660 NEXT COUNT 670 GOTO 530 ' Try for correct choice 680 ' 690 ' 700 ' 710 ' 720 ' 1000 ' Add new records to existing list (Ch. 4) 1010 ' 1020 OPEN "I",#1,"B:K-T.LST" ' OPEN B:K-T.LST for reading (Ch. 4) 1030 OPEN "O",#2,"B:COPY" ' OPEN B:COPY for writing (Ch. 4) 1040 IF EOF(1) THEN CLOSE#1:GOTO 1140 ' Check for end-of-file 1050 ' ENTRY is the MEMBER$ array subscript (Ch. 12) 1060 FOR ENTRY = 1 TO 8 ' Get next record from the file (Ch. 12) 1070 INPUT#1,MEMBER$(ENTRY) 1080 NEXT ENTRY 1090 FOR ENTRY = 1 TO 7 ' Place record in file (Ch. 12) 1100 PRINT#2,MEMBER$(ENTRY);","; 1110 NEXT ENTRY 1120 PRINT#2,MEMBER$(8) ' Last field is NOT followed by a comma (Ch. 12) 1130 GOTO 1040 ' Loop back for next record 1140 KILL "B:K-T.LST" ' Erase B:K-T.LST (Ch. 4) 1150 PRINT CL$ ' Clear screen (Ch. 7) 1160 PRINT TAB(5);"** Adding to existing membership list **" 1170 GOSUB 3000 ' Display entry screen prompts 1180 GOSUB 4000 ' INPUTs & corrections 1190 FOR ENTRY = 1 TO 7 ' Place record in file (Ch. 12) 1200 PRINT#2,MEMBER$(ENTRY);","; 1210 NEXT ENTRY 1220 PRINT#2,MEMBER$(8) ' Last field is NOT followed by a comma (Ch. 12) 1230 IF CORRECTIONS$ = "X" OR CORRECTIONS$ = "x" THEN 1250 1240 GOTO 1150 ' Loop back for next record 1250 CLOSE#2 ' CLOSE B:COPY 1260 NAME "B:COPY" AS "B:K-T.LST" ' Rename B:COPY to B:K-T.LST 1270 PRINT:PRINT ' 2 blank lines 1280 PRINT TAB(8);"Please wait. Returning to MAIN MENU." 1290 CHAIN "K-TMENU",250 ' To K-TMENU, line 270 (Ch. 11) 1300 ' 1310 ' 1320 ' 1330 ' 1340 ' 2000 ' Create new membership list file (Ch. 2) 2010 ' 2020 OPEN "O",#1,"B:K-T.LST" ' OPEN B:K-T.LST for writing 2030 PRINT CL$ ' Clear screen (Ch. 7) 2040 PRINT TAB(9);"** Creating new membership list **" 2050 GOSUB 3000 ' Display entry screen prompts 2060 GOSUB 4000 ' INPUTs & corrections 2070 FOR ENTRY = 1 TO 7 ' Place record in file (Ch. 12) 2080 PRINT#1,MEMBER$(ENTRY);","; 2090 NEXT ENTRY 2100 PRINT#1,MEMBER$(8) ' Last field is NOT followed by a comma (Ch. 12) 2110 IF CORRECTIONS$ = "X" OR CORRECTIONS$ = "x" THEN 2130 2120 GOTO 2030 ' Loop back for next record 2130 CLOSE#1 2140 GOTO 1270 ' To K-TMENU, line 270 (Ch. 11) 2150 ' 2160 ' 2170 ' 2180 ' 2190 ' 3000 ' SUBROUTINE ** KEEP-TRAK Entry Screen (Ch. 8) 3010 ' 3020 PRINT 3030 PRINT "* Enter information as requested, then press RETURN." 3040 PRINT "* At the end, opportunity exists for corrections." 3050 PRINT "* If information is not available, press RETURN." 3060 PRINT 3070 PRINT " WARNING: NEVER USE COMMAS OR QUOTATION MARKS." 3080 PRINT " IF NECESSARY, USE DASHES (-)." 3090 PRINT 3100 PRINT "****************************************************" 3110 PRINT FNBIN$; ' Begin Lowered Intensity (Ch. 8) 3120 PRINT "1 - First Name" 3130 PRINT "2 - Last Name" 3140 PRINT "3 - Street Address" 3150 PRINT "4 - City" 3160 PRINT "5 - State" 3170 PRINT "6 - Zip Code" 3180 PRINT "7 - Telephone No." 3190 PRINT "8 - Amount Paid $" 3200 PRINT FNNIN$ ' End Lowered Intensity (Ch. 8) 3210 RETURN ' End of subroutine (Ch. 5) 3220 ' 3230 ' 3240 ' 3250 ' 3260 ' 4000 ' SUBROUTINE ** Editing INPUTs (Ch. 12 for array version) 4010 ' 4020 CORRECTIONS$ = "0" ' Set variable to 0 to start 4030 FOR ENTRY = 1 TO 8 ' Loop through all INPUTS (Ch. 12) 4040 PRINT FNCUR$(10+ENTRY,20);FNCLLN$ ' Clear line (Ch. 8 & 10) 4050 PRINT FNCUR$(10+ENTRY,20);:LINE INPUT;MEMBER$(ENTRY) 4060 ON ENTRY GOSUB 5000,5000,6000,5000,5000,7000,7000,8000:IF ILLEGAL = 1 THEN 4040 ' Catch illegal entry (Ch. 10) 4070 IF VAL(CORRECTIONS$) > 0 THEN 4230 ' If correction, ignore other INPUTs 4080 NEXT ENTRY 4090 ' 4100 ' Opportunity for correcting erroneous entries 4110 ' 4120 PRINT FNCUR$(20,3);"1-8 = Edit 9 = Save entries & continue" 4130 PRINT FNCUR$(21,3);"X = No further entries, return to MAIN MENU 4140 PRINT FNCUR$(22,9);"Please choose by number or X." 4150 CORRECTIONS$ = INKEY$:IF CORRECTIONS$ = "" THEN 4150 4160 IF CORRECTIONS$ = "X" OR CORRECTIONS$ = "x" OR VAL(CORRECTIONS$) = 9 THEN RETURN 4170 IF VAL(CORRECTIONS$) > 0 AND VAL(CORRECTIONS$) < 9 THEN ENTRY = VAL(CORRECTIONS$):GOTO 4040 ' Ch. 12 4180 ' 4190 ' 4200 ' Catch illegal choices 4210 ' 4220 PRINT CHR$(7); ' Beeper (Ch. 10) 4230 FOR COUNT = 1 TO 3 ' Blink "Please choose" (Ch. 8) 4240 PRINT FNCUR$(22,9);FNCLLN$ ' Clear line (line indentation Ch. 11) 4250 FOR PAUSE = 1 TO 100:NEXT PAUSE ' Count to 100 silently (Ch. 7) 4260 PRINT FNCUR$(22,9);"Please choose by number or X." 4270 FOR PAUSE = 1 TO 100:NEXT PAUSE ' Count to 100 silently (Ch. 7) 4280 NEXT COUNT 4290 GOTO 4150 ' Try for correct choice 4300 ' 4310 ' 4320 ' 4330 ' 4340 ' 5000 ' SUBROUTINE ** Prevent illegal first name, last name, city, & state entries (Chs. 10 & 12) 5010 ' 5020 ILLEGAL = 0 ' No illegal entries yet, checking 5030 IF MEMBER$(ENTRY) = "" THEN MEMBER$(ENTRY) = "N/A":GOTO 5220 5040 FOR CHECK = 1 TO LEN(MEMBER$(ENTRY)) ' Legal entries on next line 5050 IF ASC(MID$(MEMBER$(ENTRY),CHECK,1)) >= 65 AND ASC(MID$(MEMBER$(ENTRY),CHECK,1)) <= 90 THEN 5210 ' A through Z 5060 IF ASC(MID$(MEMBER$(ENTRY),CHECK,1)) >= 97 AND ASC(MID$(MEMBER$(ENTRY),CHECK,1)) <= 122 THEN 5210 ' a through z 5070 IF ASC(MID$(MEMBER$(ENTRY),CHECK,1)) = 32 OR ASC(MID$(MEMBER$(ENTRY),CHECK,1)) = 38 OR ASC(MID$(MEMBER$(ENTRY),CHECK,1)) = 39 THEN 5210 ' Space, apostrophe, & ampersand 5080 IF ASC(MID$(MEMBER$(ENTRY),CHECK,1)) >= 45 AND ASC(MID$(MEMBER$(ENTRY),CHECK,1)) <= 46 THEN 5210 ' Dash & period 5090 ILLEGAL = 1 ' Illegal entry found 5100 PRINT CHR$(7) ' Beep (Ch. 10) 5110 PRINT FNCUR$(3,0);FNCLLN$ ' Clear third line from top 5120 PRINT FNCUR$(5,0);FNCLLN$ ' Clear fifth line from top 5130 FOR COUNT = 1 TO 3 ' Blink error message 5140 PRINT FNCUR$(4,0);FNCLLN$ ' Clear fourth line from top 5150 FOR PAUSE = 1 TO 100:NEXT PAUSE ' Count to 100 silently (Ch. 7) 5160 PRINT FNCUR$(4,20);"Illegal Entry!" 5170 FOR PAUSE = 1 TO 100:NEXT PAUSE ' Count to 100 silently (Ch. 7) 5180 NEXT COUNT 5190 PRINT FNCUR$(5,8);"Please re-enter without punctuation." 5200 RETURN 5210 NEXT CHECK 5220 GOSUB 9000 ' Replace INPUT instructions 5230 RETURN 5240 ' 5250 ' 5260 ' 5270 ' 5280 ' 6000 ' SUBROUTINE ** Prevent illegal street address entries (Chs. 10 & 12) 6010 ' 6020 ILLEGAL = 0 ' No illegal entries yet, checking 6030 IF MEMBER$(ENTRY) = "" THEN MEMBER$(ENTRY) = "N/A":GOTO 6200 6040 FOR CHECK = 1 TO LEN(MEMBER$(ENTRY)) ' Legal entries on next line 6050 IF ASC(MID$(MEMBER$(ENTRY),CHECK,1)) >= 45 AND ASC(MID$(MEMBER$(ENTRY),CHECK,1)) <= 122 THEN 6190 ' All numbers, letters, period, & dash 6060 IF ASC(MID$(MEMBER$(ENTRY),CHECK,1)) = 32 OR ASC(MID$(MEMBER$(ENTRY),CHECK,1)) = 35 OR ASC(MID$(MEMBER$(ENTRY),CHECK,1)) = 39 THEN 6190 ' Space, hash mark, & apostrophe 6070 ILLEGAL = 1 ' Illegal entry found 6080 PRINT CHR$(7) ' Beep (Ch. 10) 6090 PRINT FNCUR$(3,0);FNCLLN$ ' Clear third line from top 6100 PRINT FNCUR$(5,0);FNCLLN$ ' Clear fifth line from top 6110 FOR COUNT = 1 TO 3 ' Blink error message 6120 PRINT FNCUR$(4,0);FNCLLN$ ' Clear fourth line from top 6130 FOR PAUSE = 1 TO 100:NEXT PAUSE ' Count to 100 silently (Ch. 7) 6140 PRINT FNCUR$(4,20);"Illegal Entry!" 6150 FOR PAUSE = 1 TO 100:NEXT PAUSE ' Count to 100 silently (Ch. 7) 6160 NEXT COUNT 6170 PRINT FNCUR$(5,8);"Please re-enter without punctuation." 6180 RETURN 6190 NEXT CHECK 6200 GOSUB 9000 ' Replace INPUT instructions 6210 RETURN 6220 ' 6230 ' 6240 ' 6250 ' 6260 ' 7000 ' SUBROUTINE ** Prevent illegal phone # & ZIP code entries (Chs. 10 & 12) 7010 ' 7020 ILLEGAL = 0 ' No illegal entries yet, checking 7030 IF MEMBER$(ENTRY) = "" THEN MEMBER$(ENTRY) = "N/A":GOTO 7190 7040 FOR CHECK = 1 TO LEN(MEMBER$(ENTRY)) ' Legal entries on next line 7050 IF ASC(MID$(MEMBER$(ENTRY),CHECK,1)) >= 48 AND ASC(MID$(MEMBER$(ENTRY),CHECK,1)) <= 57 OR ASC(MID$(MEMBER$(ENTRY),CHECK,1)) = 45 THEN 7180 ' Digits & dash 7060 ILLEGAL = 1 ' Illegal entry found 7070 PRINT CHR$(7) ' Beep (Ch. 10) 7080 PRINT FNCUR$(3,0);FNCLLN$ ' Clear third line from top 7090 PRINT FNCUR$(5,0);FNCLLN$ ' Clear fifth line from top 7100 FOR COUNT = 1 TO 3 ' Blink error message 7110 PRINT FNCUR$(4,0);FNCLLN$ ' Clear fourth line from top 7120 FOR PAUSE = 1 TO 100:NEXT PAUSE ' Count to 100 silently (Ch. 7) 7130 PRINT FNCUR$(4,20);"Illegal Entry!" 7140 FOR PAUSE = 1 TO 100:NEXT PAUSE ' Count to 100 silently (Ch. 7) 7150 NEXT COUNT 7160 PRINT FNCUR$(5,4);"Please re-enter with digits and dashes only." 7170 RETURN 7180 NEXT CHECK 7190 GOSUB 9000 ' Replace INPUT instructions 7200 RETURN 7210 ' 7220 ' 7230 ' 7240 ' 7250 ' 8000 ' SUBROUTINE ** Prevent illegal dues payment entries (Chs. 10 & 12) 8010 ' 8020 ILLEGAL = 0 ' No illegal entries yet, checking 8030 IF MEMBER$(ENTRY) = "" THEN MEMBER$(ENTRY) = "0":GOTO 8190 8040 FOR CHECK = 1 TO LEN(MEMBER$(ENTRY)) ' Legal entries on next line 8050 IF ASC(MID$(MEMBER$(ENTRY),CHECK,1)) >= 48 AND ASC(MID$(MEMBER$(ENTRY),CHECK,1)) <= 57 OR ASC(MID$(MEMBER$(ENTRY),CHECK,1)) = 46 THEN 8180 ' Digits & period (decimal pt.) 8060 ILLEGAL = 1 ' Illegal entry found 8070 PRINT CHR$(7) ' Beep (Ch. 10) 8080 PRINT FNCUR$(3,0);FNCLLN$ ' Clear third line from top 8090 PRINT FNCUR$(5,0);FNCLLN$ ' Clear fifth line from top 8100 FOR COUNT = 1 TO 3 ' Blink error message 8110 PRINT FNCUR$(4,0);FNCLLN$ ' Clear fourth line from top 8120 FOR PAUSE = 1 TO 100:NEXT PAUSE ' Count to 100 silently (Ch. 7) 8130 PRINT FNCUR$(4,20);"Illegal Entry!" 8140 FOR PAUSE = 1 TO 100:NEXT PAUSE ' Count to 100 silently (Ch. 7) 8150 NEXT COUNT 8160 PRINT FNCUR$(5,2);"Please re-enter: Digits (& decimal pt) only." 8170 RETURN 8180 NEXT CHECK 8190 GOSUB 9000 ' Replace INPUT instructions 8200 RETURN 8210 ' 8220 ' 8230 ' 8240 ' 8250 ' 9000 ' SUBROUTINE ** Replace INPUT instructions if correct INPUT 9010 ' 9020 PRINT FNCUR$(3,0);"* Enter information as requested, then press RETURN." 9030 PRINT "* At the end, opportunity exists for corrections." 9040 PRINT "* If information is not available, press RETURN." 9050 RETURN 9060 ' 9070 ' 9080 ' 9090 ' 9100 ' 20000 ' ** Error Traps ** (Ch. 10) 20010 ' 20020 ' Trap "File not found" in line 310 (Ch. 10) 20030 ' 20040 IF ERR <> 53 AND ERL <> 310 THEN 20170 20050 ' Line 20110 executes only if "File not found" in line 260. 20060 ' 20070 ' Since there's no B:K-T.LST file, the only 20080 ' thing to do is create one. The code for 20090 ' that begins on line 2000. Therefore, go 20100 ' to line 2000 and create a new file. 20110 RESUME 2000 20120 ' 20130 ' 20140 ' 20150 ' 20160 ' 20170 ' Catch-all error trap (Ch. 10) 20180 ' 20190 PRINT CHR$(7) ' Beep (Ch. 10) 20200 PRINT CL$ ' Clear screen (Ch. 7) 20210 PRINT:PRINT ' 2 blank lines 20220 PRINT "You have generated error number";ERR 20230 PRINT "on line number";ERL;"." 20240 PRINT 20250 PRINT "Please write this fact down. Also write down ex-" 20260 PRINT "actly what you did before this error took place." 20270 PRINT 20280 PRINT "Ask a BASIC programmer what the error means and" 20290 PRINT "how to correct it." 20300 PRINT:PRINT ' 2 blank lines 20310 PRINT "Press any key to return to the MAIN MENU." 20320 IF INKEY$ = "" THEN 20320 ' Waiting for keypress (Ch. 7) 20330 RESUME 1270 ' Return to MAIN MENU