home *** CD-ROM | disk | FTP | other *** search
GW-BASIC | 1985-09-14 | 8.3 KB | 212 lines |
- 10 REM COPYWRITE (C) JANUARY 5, 1985
- 20 REM BY TIMOTHY NOLAN KLIEWER
- 30 REM JOHN BROWN UNIVERSITY
- 40 REM SILOAM SPRINGS, ARKANSAS 72761
- 50 REM PUBLISHING RIGHTS GRANTED TO I.B.Magazette
- 60 REM THIS PROGRAM MAY NOT BE SOLD FOR PROFIT
- 70 REM UNLESS GRANTED WRITTEN PERMISSION FROM T. KLIEWER
- 80 REM P.O. BOX 999, SILOAM SPRINGS, AR 72761
- 90 CLS:KEY OFF:COLOR 3,0,4
- 91 LOCATE 3,20,0:PRINT"LIBRARY INVENTORY PROGRAM"
- 92 PRINT:PRINT:PRINT
- 93 PRINT" Do you wish to review the documentation and instructions(Y/N)";
- 94 INPUT ANS$:IF ANS$ = "n" OR ANS$ = "N" THEN GOTO 760
- 100 PRINT:PRINT
- 110 PRINT " LIBRARY INVENTORY PROGRAM "
- 120 PRINT " This program is designed to inventory your personal library"
- 130 PRINT " and is unique in that it not only records your books by"
- 140 PRINT " by author and title, but it also records who you have loaned"
- 150 PRINT " it to and has a 30 character (max) memo section for special"
- 160 PRINT " notes on the book, author, or loanee! This feature is "
- 170 PRINT " especially helpful to those of us who have a memory section "
- 180 PRINT " smaller than any normal printer buffer."
- 190 PRINT:PRINT
- 200 PRINT " The INVENTORY -- MAIN MENU has 5 sections: LIST, CREATE,"
- 210 PRINT " REVISE, DELETE, and EXIT. These are explained briefly and"
- 220 PRINT " concisely in the following sections."
- 230 PRINT:PRINT
- 240 PRINT " The program is a file handling program and has not set limits"
- 250 PRINT " on the maximum number of records allowable in each file. "
- 260 PRINT " It has been suggested that if the library being inventoried"
- 270 PRINT " is quite extensive that it should be broken down into several"
- 280 PRINT " different catagories (i.e. Biographies, Fiction, Science, etc...)"
- 290 PRINT " Each would be a separate file (i.e. BIOG, FICT, SCIENCE, etc...)
- 300 PRINT " of no more than 8 characters in each name. "
- 310 GOSUB 2190
- 320 CLS
- 330 PRINT
- 340 PRINT " OPTIONS:"
- 350 PRINT " 1 - LIST : This option allows you to list a file books already"
- 360 PRINT " recorded. When the '1' is punched the program will"
- 370 PRINT " give you a list of files (without 'suffixes') and procede to ask
- 380 PRINT " for a specific file (one that already exists, please). After "
- 390 PRINT " you have given a file and hit the return key, the computer will"
- 400 PRINT " ask whether it should feed data to the printer or screen (P/S),"
- 410 PRINT " then attempt to list what is in the file. Hit any key to pause."
- 420 PRINT
- 430 PRINT " 2 - CREATE : This option allows you to create different files."
- 440 PRINT " When '2' is pushed, the program will give a list of "
- 450 PRINT " files that already exist and ask for the name of the new file."
- 460 PRINT " If an old file is typed in the file will be erased and a new file"
- 470 PRINT " will be written on top of it with the same name. The rest of this"
- 480 PRINT " option is self-explanitory, just follow directions!!!
- 490 PRINT
- 500 PRINT " 3 - REVISE : This option allows you to revise and add to an"
- 510 PRINT " existing file. The first question on the screen"
- 520 PRINT " asks about adding to this file. If yes, it will procede as create,"
- 530 PRINT " otherwise it will ask to search for a character or string. "
- 540 PRINT " If found, 'DO YOU WISH TO CHANGE THIS ENTRY?' ;if no then back"
- 550 PRINT " to the search question."
- 560 GOSUB 2190
- 570 CLS
- 580 PRINT:PRINT
- 590 PRINT " 4 - DELETE : This option functions just as it sounds. As '4'"
- 600 PRINT " is hit, the computer gives the list of files and the asks for"
- 610 PRINT " that unlucky file to be cleared off the diskette and procedes"
- 620 PRINT " to do its purpose."
- 630 PRINT:PRINT
- 640 PRINT " 5 - EXIT - PROGRAM TERMINATION"
- 650 PRINT:PRINT:PRINT
- 680 PRINT " This program does not alphabetize these entries because"
- 690 PRINT " 'How many personal libraries have you seen that are"
- 700 PRINT " in alphabetical order and not organized from 'best-loved'"
- 710 PRINT " to 'hated'?'. I rest my case.
- 720 PRINT:PRINT
- 730 PRINT " To get on with this wonderfully DONE masterpiece,"
- 740 PRINT " I leave you with the last line:"
- 750 GOSUB 2190
- 760 CLS :ON ERROR GOTO 5000
- 770 LOCATE 1,1 'inventory graphic menu
- 780 PRINT CHR$(201);STRING$(24,205);" INVENTORY -- MAIN MENU ";STRING$(30,205);CHR$(187)
- 850 FOR X = 2 TO 4 :LOCATE X,1:PRINT CHR$(186):LOCATE X,80:PRINT CHR$(186):NEXT
- 890 LOCATE 5,1,0 :PRINT CHR$(200);STRING$(78,205);CHR$(188)
- 940 LOCATE 3,8,0 :PRINT "1 - LIST 2 - CREATE 3 - REVISE 4 - DELETE 5 - EXIT"
- 960 LOCATE 6,27,1 :PRINT "WHAT IS YOUR CHOICE?";
- 970 A$=INKEY$:A = VAL(A$):IF A < 1 OR A > 5 THEN 970 ELSE PRINT A$
- 1010 IF A=5 THEN CLS:END 'option 5 (exit)
- 1012 IF A = 2 THEN GOSUB 6012:GOTO 1130
- 1020 LOCATE 9,1
- 1040 FILES "*.*" 'show current files
- 1050 'ON ERROR GOTO 760
- 1070 LOCATE 7,27,1 :INPUT "WHICH FILE TO USE ",A$ :IF LEN(A$)<1 THEN 1070
- 1100 'IF A=2 THEN OPEN A$ AS 1 LEN=120:CLOSE
- 1110 IF A=4 THEN CLOSE:KILL A$ 'option 4 (delete)
- 1120 IF A=4 THEN GOTO 760
- 1130 OPEN A$ AS #1 LEN=120
- 1140 FIELD #1,30 AS Z1$,30 AS Z2$,30 AS Z3$,30 AS Z4$
- 1150 ON A GOTO 1160,1390,1620
- 1160 CLS 'option 1 (list)
- 1180 PRINT "TO THE (P)RINTER OR (S)CREEN?";
- 1190 YN$=INKEY$: IF YN$ ="" THEN 1190
- 1200 IF (YN$="P" OR YN$="p") THEN Z=1 ELSE Z=0
- 1210 A=1:GET #1,A
- 1220 IF Z1$="DONE"+SPACE$(26) THEN 1340
- 1260 IF Z=1 THEN LPRINT:LPRINT"AUTHOR: ";TAB(15); Z1$:LPRINT "BOOK TITLE: ";TAB(15);Z2$:LPRINT "LOANED TO: ";TAB(15);Z3$:LPRINT "MEMO: ";TAB(15);Z4$
- 1270 IF Z<>1 THEN PRINT:PRINT"AUTHOR: ";TAB(15); Z1$:PRINT "BOOK TITLE: ";TAB(15);Z2$:PRINT "LOANED TO: ";TAB(15);Z3$:PRINT "MEMO: ";TAB(15);Z4$
- 1280 A=A+1
- 1290 GET #1,A
- 1320 GOSUB 2190 :GOTO 1220
- 1340 LOCATE 25,10
- 1350 PRINT "HIT ANY KEY TO RETURN TO THE MAIN MENU."
- 1360 CLOSE
- 1370 YN$=INKEY$ :IF YN$="" THEN 1370 ELSE 760
- 1390 CLS 'option 2 (create)
- 1400 LOCATE 7,10
- 1410 PRINT"PLEASE INPUT THE FOLLOWING INFORMATION."
- 1420 Z=0:A=0 'initialize flag and record number
- 1430 LOCATE 25,10
- 1440 PRINT"CREATE : TYPE 'DONE, DONE' FOR THE AUTHOR'S NAME WHEN FINISHED."
- 1450 LOCATE 10,10
- 1460 C$=SPACE$(30)
- 1470 B$=SPACE$(30)
- 1480 D$=SPACE$(30)
- 1490 GOSUB 2110
- 1500 IF Z=1 THEN GOTO 1540
- 1510 PRINT TAB(10);:INPUT"BOOK TITLE: ",B$
- 1520 PRINT TAB(10);:INPUT"LOANED TO: ",C$
- 1530 PRINT TAB(10);:INPUT"MEMO (30 CHARACTERS): ",D$
- 1540 LSET Z2$=B$
- 1550 LSET Z3$=C$
- 1560 LSET Z4$=D$
- 1570 A=A+1
- 1580 PUT #1,A 'store the information
- 1590 IF Z=1 THEN CLOSE:GOTO 760
- 1600 CLS
- 1610 GOTO 1430
- 1620 ON ERROR GOTO 0 'option 3 (revise)
- 1630 CLS
- 1640 B=1
- 1650 LOCATE 25,10,1
- 1660 PRINT SPACE$(50)
- 1670 LOCATE 25,10,1
- 1680 PRINT"REVISE -- TYPE 'DONE' IN THE SEARCHED FOR SECTION TO END."
- 1690 LOCATE 10,10,1
- 1700 PRINT "WOULD YOU LIKE TO ADD TO THIS FILE?";
- 1710 YN$=INKEY$:IF YN$="" THEN 1710
- 1720 PRINT YN$:IF (YN$="Y" OR YN$="y") THEN CLS:Z=2:GOSUB 2250:GOTO 2050
- 1730 CLS
- 1740 LOCATE 25,10,1
- 1750 PRINT"REVISE -- TYPE 'DONE' IN THE SEARCHED FOR SECTION TO END."
- 1760 LOCATE 10,10,1
- 1770 PRINT "WHAT WOULD YOU LIKE TO SEARCH FOR?"
- 1780 PRINT TAB(10);:INPUT E$
- 1790 IF (E$="DONE" OR E$="done") THEN CLOSE:GOTO 760
- 1800 GOSUB 2250
- 1810 IF C>0 THEN PRINT:PRINT "AUTHOR: ";TAB(15);Z1$:PRINT"BOOK TITLE: ";TAB(15);Z2$:PRINT"LOANED TO: ";TAB(15);Z3$:PRINT"MEMO: ";TAB(15);Z4$ ELSE CLS
- 1820 IF C<=0 THEN LOCATE 10,10:PRINT TAB(10) "THAT STRING IS NOT FOUND IN THIS FILE." :B=1:FOR I=1 TO 1000:NEXT:GOTO 1670
- 1830 PRINT:PRINT "WOULD YOU LIKE TO SEARCH FOR A LATER ENTRY OF ";E$;"? ";
- 1840 YN$=INKEY$:IF YN$="" THEN 1840
- 1850 PRINT YN$
- 1860 IF (YN$="N"OR YN$="n") THEN GOTO 1880
- 1870 A=A+1 :GOSUB 2260 :GOTO 1810
- 1880 PRINT:PRINT "DO YOU WISH TO CHANGE THIS ENTRY?";
- 1890 YN$=INKEY$:IF YN$="" THEN 1890
- 1900 PRINTYN$
- 1910 IF (YN$="N" OR YN$="n") THEN GOTO 1620
- 1915 Z=3
- 1920 GOSUB 2110
- 1930 IF Z=1 THEN GOTO 2000
- 1940 B$=SPACE$(40)
- 1950 C$=SPACE$(30)
- 1960 D$=SPACE$(50)
- 1970 INPUT "BOOK TITLE: ",B$
- 1980 INPUT "LOANED TO: ",C$
- 1990 INPUT "MEMO (30 CHARACTERS):",D$
- 2000 LSET Z2$=LEFT$(B$,40)
- 2010 LSET Z3$=LEFT$(C$,30)
- 2020 LSET Z4$=LEFT$(D$,50)
- 2030 PUT #1,B-1 'store new information
- 2040 IF Z<>2 GOTO 1620
- 2050 CLS:LOCATE 25,10:PRINT "TYPE 'DONE,DONE' FOR THE AUTHOR'S NAME WHEN FINISHED."
- 2060 IF Z=1 THEN GOTO 1730 ELSE LOCATE 10,1:B=B+1:GOTO 1920
- 2110 B$="" 'author's name routine
- 2120 C$=""
- 2130 A1$=" "
- 2140 INPUT"AUTHOR'S NAME(LAST, FIRST): ",B$,C$
- 2150 IF ((B$="done" OR B$="DONE") AND (C$="done" OR C$="DONE")) THEN LSET Z1$="DONE":Z=1:RETURN
- 2160 B$=LEFT$(B$+A1$,15)
- 2170 LSET Z1$=B$+C$
- 2180 RETURN
- 2190 COLOR 12:LOCATE 24,10,0:PRINT"* * * Use Shift/PrtSc for a copy of this page. * * *";
- 2200 COLOR 0,3:LOCATE 25,20,0:PRINT" PRESS ANY KEY TO CONTINUE ";:COLOR 3,0
- 2210 A$=INKEY$
- 2220 IF A$="" THEN 2210
- 2230 LOCATE ,,1
- 2240 RETURN
- 2250 A=1 'search routine
- 2260 GET #1,A
- 2270 F$=Z1$+Z2$+Z3$+Z4$
- 2280 C=INSTR(F$,E$)
- 2290 IF Z=2 GOTO 2310
- 2300 IF C>0 THEN B=A+1:RETURN ELSE A=A+1:GOTO 2260
- 2310 IF Z1$="DONE"+SPACE$(26) THEN B=A:RETURN
- 2315 A = A + 1:GOTO 2260
- 2320 RETURN
- 5000 'ERROR ROUTINE
- 5010 IF ERR = 53 THEN LOCATE 15,5,0 :PRINT"SORRY YOU HAVE NO FILES!"
- 5020 RESUME 770
- 6012 IF A = 2 THEN LOCATE 6,27,1 :PRINT"FILES ON THIS DISK ARE:":FILES "A:*.*"
- 6014 PRINT" TO CREATE A FILE, YOU MUST DEFINE A NEW NAME."
- 6016 PRINT" IT MUST BE LESS THAN 8 CHARACTERS, NO EXTENTION PLEASE."
- 6018 INPUT" WHAT FILENAME DO YOU WANT TO DEFINE ";A$:RETURN
-