home *** CD-ROM | disk | FTP | other *** search
/ Shareware Grab Bag / Shareware Grab Bag.iso / 005 / libinvt.bas (.txt) < prev    next >
Encoding:
GW-BASIC  |  1985-09-14  |  8.3 KB  |  212 lines

  1. 10  REM COPYWRITE (C) JANUARY 5, 1985
  2. 20  REM BY TIMOTHY NOLAN KLIEWER
  3. 30  REM JOHN BROWN UNIVERSITY
  4. 40  REM SILOAM SPRINGS, ARKANSAS  72761
  5. 50  REM PUBLISHING RIGHTS GRANTED TO I.B.Magazette
  6. 60  REM THIS PROGRAM MAY NOT BE SOLD FOR PROFIT
  7. 70  REM UNLESS GRANTED WRITTEN PERMISSION FROM T. KLIEWER
  8. 80  REM P.O. BOX 999, SILOAM SPRINGS, AR 72761
  9. 90  CLS:KEY OFF:COLOR 3,0,4
  10. 91  LOCATE 3,20,0:PRINT"LIBRARY INVENTORY PROGRAM"
  11. 92  PRINT:PRINT:PRINT
  12. 93  PRINT"      Do you wish to review the documentation and instructions(Y/N)";
  13. 94  INPUT ANS$:IF ANS$ = "n" OR ANS$ = "N" THEN GOTO 760
  14. 100  PRINT:PRINT
  15. 110  PRINT "                    LIBRARY INVENTORY PROGRAM "
  16. 120  PRINT "    This program is designed to inventory your personal library"
  17. 130  PRINT "    and is unique in that it not only records your books by"
  18. 140  PRINT "    by author and title, but it also records who you have loaned"
  19. 150  PRINT "    it to and has a 30 character (max) memo section for special"
  20. 160  PRINT "    notes on the book, author, or loanee!  This feature is "
  21. 170  PRINT "    especially helpful to those of us who have a memory section "
  22. 180  PRINT "    smaller than any normal printer buffer."
  23. 190  PRINT:PRINT
  24. 200  PRINT "    The INVENTORY  --  MAIN MENU has 5 sections: LIST, CREATE,"
  25. 210  PRINT "    REVISE, DELETE, and EXIT.  These are explained briefly and"
  26. 220  PRINT "    concisely in the following sections."
  27. 230  PRINT:PRINT
  28. 240  PRINT "    The program is a file handling program and has not set limits"
  29. 250  PRINT "    on the maximum number of records allowable in each file.  "
  30. 260  PRINT "    It has been suggested that if the library being inventoried"
  31. 270  PRINT "    is quite extensive that it should be broken down into several"
  32. 280  PRINT "    different catagories (i.e. Biographies, Fiction, Science, etc...)"
  33. 290  PRINT "    Each would be a separate file (i.e. BIOG, FICT, SCIENCE, etc...)
  34. 300  PRINT "    of no more than 8 characters in each name.  "
  35. 310  GOSUB 2190
  36. 320  CLS
  37. 330  PRINT
  38. 340  PRINT "                             OPTIONS:"
  39. 350  PRINT "    1 - LIST :  This option allows you to list a file books already"
  40. 360  PRINT "                recorded.  When the '1' is punched the program will"
  41. 370  PRINT "    give you a list of files (without 'suffixes') and procede to ask
  42. 380  PRINT "    for a specific file (one that already exists, please).  After "
  43. 390  PRINT "    you have given a file and hit the return key, the computer will"
  44. 400  PRINT "    ask whether it should feed data to the printer or screen (P/S),"
  45. 410  PRINT "    then attempt to list what is in the file.  Hit any key to pause."
  46. 420  PRINT
  47. 430  PRINT "    2 - CREATE :  This option allows you to create different files."
  48. 440  PRINT "                  When '2' is pushed, the program will give a list of "
  49. 450  PRINT "    files that already exist and ask for the name of the new file."
  50. 460  PRINT "    If an old file is typed in the file will be erased and a new file"
  51. 470  PRINT "    will be written on top of it with the same name.  The rest of this"
  52. 480  PRINT "    option is self-explanitory, just follow directions!!!
  53. 490  PRINT
  54. 500  PRINT "    3 - REVISE :  This option allows you to revise and add to an"
  55. 510  PRINT "                  existing file.  The first question on the screen"
  56. 520  PRINT "    asks about adding to this file.  If yes, it will procede as create,"
  57. 530  PRINT "    otherwise it will ask to search for a character or string.  "
  58. 540  PRINT "    If found, 'DO YOU WISH TO CHANGE THIS ENTRY?' ;if no then back"
  59. 550  PRINT "    to the search question."
  60. 560  GOSUB 2190
  61. 570  CLS
  62. 580  PRINT:PRINT
  63. 590  PRINT "    4 - DELETE :  This option functions just as it sounds.  As '4'"
  64. 600  PRINT "    is hit, the computer gives the list of files and the asks for"
  65. 610  PRINT "    that unlucky file to be cleared off the diskette and procedes"
  66. 620  PRINT "    to do its purpose."
  67. 630  PRINT:PRINT
  68. 640  PRINT "    5 - EXIT - PROGRAM TERMINATION"
  69. 650  PRINT:PRINT:PRINT
  70. 680  PRINT "    This program does not alphabetize these entries because"
  71. 690  PRINT "    'How many personal libraries have you seen that are"
  72. 700  PRINT "    in alphabetical order and not organized from 'best-loved'"
  73. 710  PRINT "    to 'hated'?'.  I rest my case.
  74. 720  PRINT:PRINT
  75. 730  PRINT "    To get on with this wonderfully DONE masterpiece,"
  76. 740  PRINT "    I leave you with the last line:"
  77. 750  GOSUB 2190
  78. 760  CLS :ON ERROR GOTO 5000
  79. 770  LOCATE 1,1                             'inventory graphic menu
  80. 780  PRINT CHR$(201);STRING$(24,205);" INVENTORY -- MAIN MENU ";STRING$(30,205);CHR$(187)
  81. 850  FOR X = 2 TO 4 :LOCATE X,1:PRINT CHR$(186):LOCATE X,80:PRINT CHR$(186):NEXT
  82. 890  LOCATE 5,1,0 :PRINT CHR$(200);STRING$(78,205);CHR$(188)
  83. 940  LOCATE 3,8,0 :PRINT "1 - LIST     2 - CREATE     3 - REVISE     4 - DELETE     5 - EXIT"
  84. 960  LOCATE 6,27,1 :PRINT "WHAT IS YOUR CHOICE?";
  85. 970  A$=INKEY$:A = VAL(A$):IF A < 1  OR A > 5  THEN 970  ELSE PRINT A$
  86. 1010  IF A=5 THEN CLS:END               'option 5 (exit)
  87. 1012  IF A = 2 THEN GOSUB 6012:GOTO 1130
  88. 1020  LOCATE 9,1
  89. 1040  FILES "*.*"                             'show current files
  90. 1050  'ON ERROR GOTO 760
  91. 1070  LOCATE 7,27,1 :INPUT "WHICH FILE TO USE ",A$ :IF LEN(A$)<1 THEN 1070
  92. 1100  'IF A=2 THEN OPEN A$ AS 1 LEN=120:CLOSE
  93. 1110  IF  A=4         THEN CLOSE:KILL A$      'option 4 (delete)
  94. 1120  IF A=4 THEN GOTO 760
  95. 1130  OPEN A$ AS #1 LEN=120
  96. 1140  FIELD #1,30 AS Z1$,30 AS Z2$,30 AS Z3$,30 AS Z4$
  97. 1150  ON A GOTO 1160,1390,1620
  98. 1160  CLS                                   'option 1 (list)
  99. 1180  PRINT "TO THE (P)RINTER OR (S)CREEN?";
  100. 1190  YN$=INKEY$: IF YN$ ="" THEN 1190
  101. 1200  IF (YN$="P" OR YN$="p") THEN Z=1 ELSE Z=0
  102. 1210  A=1:GET #1,A
  103. 1220  IF Z1$="DONE"+SPACE$(26) THEN 1340
  104. 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$
  105. 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$
  106. 1280  A=A+1
  107. 1290  GET #1,A
  108. 1320  GOSUB 2190  :GOTO 1220
  109. 1340  LOCATE 25,10
  110. 1350  PRINT "HIT ANY KEY TO RETURN TO THE MAIN MENU."
  111. 1360  CLOSE
  112. 1370  YN$=INKEY$ :IF YN$="" THEN 1370 ELSE 760
  113. 1390  CLS                                   'option 2 (create)
  114. 1400  LOCATE 7,10
  115. 1410  PRINT"PLEASE INPUT THE FOLLOWING INFORMATION."
  116. 1420  Z=0:A=0                               'initialize flag and record number
  117. 1430  LOCATE 25,10
  118. 1440  PRINT"CREATE : TYPE 'DONE, DONE' FOR THE AUTHOR'S NAME WHEN FINISHED."
  119. 1450  LOCATE 10,10
  120. 1460  C$=SPACE$(30)
  121. 1470  B$=SPACE$(30)
  122. 1480  D$=SPACE$(30)
  123. 1490  GOSUB 2110
  124. 1500  IF Z=1 THEN GOTO 1540
  125. 1510  PRINT TAB(10);:INPUT"BOOK TITLE: ",B$
  126. 1520  PRINT TAB(10);:INPUT"LOANED TO:  ",C$
  127. 1530  PRINT TAB(10);:INPUT"MEMO (30 CHARACTERS): ",D$
  128. 1540  LSET Z2$=B$
  129. 1550  LSET Z3$=C$
  130. 1560  LSET Z4$=D$
  131. 1570  A=A+1
  132. 1580  PUT #1,A                              'store the information
  133. 1590  IF Z=1 THEN CLOSE:GOTO 760
  134. 1600  CLS
  135. 1610  GOTO 1430
  136. 1620  ON ERROR GOTO  0                      'option 3 (revise)
  137. 1630  CLS
  138. 1640  B=1
  139. 1650  LOCATE 25,10,1
  140. 1660  PRINT SPACE$(50)
  141. 1670  LOCATE 25,10,1
  142. 1680  PRINT"REVISE -- TYPE 'DONE' IN THE SEARCHED FOR SECTION TO END."
  143. 1690  LOCATE 10,10,1
  144. 1700  PRINT "WOULD YOU LIKE TO ADD TO THIS FILE?";
  145. 1710  YN$=INKEY$:IF YN$="" THEN 1710
  146. 1720  PRINT YN$:IF (YN$="Y" OR YN$="y") THEN CLS:Z=2:GOSUB 2250:GOTO 2050
  147. 1730  CLS
  148. 1740  LOCATE 25,10,1
  149. 1750  PRINT"REVISE -- TYPE 'DONE' IN THE SEARCHED FOR SECTION TO END."
  150. 1760  LOCATE 10,10,1
  151. 1770  PRINT "WHAT WOULD YOU LIKE TO SEARCH FOR?"
  152. 1780  PRINT TAB(10);:INPUT E$
  153. 1790  IF (E$="DONE" OR E$="done") THEN CLOSE:GOTO 760
  154. 1800  GOSUB 2250
  155. 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
  156. 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
  157. 1830  PRINT:PRINT "WOULD YOU LIKE TO SEARCH FOR A LATER ENTRY OF ";E$;"? ";
  158. 1840  YN$=INKEY$:IF YN$="" THEN 1840
  159. 1850  PRINT YN$
  160. 1860  IF (YN$="N"OR YN$="n") THEN GOTO 1880
  161. 1870  A=A+1 :GOSUB 2260 :GOTO 1810
  162. 1880  PRINT:PRINT "DO YOU WISH TO CHANGE THIS ENTRY?";
  163. 1890  YN$=INKEY$:IF YN$="" THEN 1890
  164. 1900  PRINTYN$
  165. 1910  IF (YN$="N" OR YN$="n") THEN GOTO 1620
  166. 1915  Z=3
  167. 1920  GOSUB 2110
  168. 1930  IF Z=1 THEN GOTO 2000
  169. 1940  B$=SPACE$(40)
  170. 1950  C$=SPACE$(30)
  171. 1960  D$=SPACE$(50)
  172. 1970  INPUT "BOOK TITLE: ",B$
  173. 1980  INPUT "LOANED TO:  ",C$
  174. 1990  INPUT "MEMO (30 CHARACTERS):",D$
  175. 2000  LSET Z2$=LEFT$(B$,40)
  176. 2010  LSET Z3$=LEFT$(C$,30)
  177. 2020  LSET Z4$=LEFT$(D$,50)
  178. 2030  PUT #1,B-1                            'store new information
  179. 2040  IF Z<>2 GOTO 1620
  180. 2050  CLS:LOCATE 25,10:PRINT "TYPE 'DONE,DONE' FOR THE AUTHOR'S NAME WHEN FINISHED."
  181. 2060  IF Z=1 THEN GOTO 1730 ELSE LOCATE 10,1:B=B+1:GOTO 1920
  182. 2110  B$=""                                 'author's name routine
  183. 2120  C$=""
  184. 2130  A1$="                    "
  185. 2140  INPUT"AUTHOR'S NAME(LAST, FIRST): ",B$,C$
  186. 2150  IF ((B$="done" OR B$="DONE") AND (C$="done" OR C$="DONE")) THEN LSET Z1$="DONE":Z=1:RETURN
  187. 2160  B$=LEFT$(B$+A1$,15)
  188. 2170  LSET Z1$=B$+C$
  189. 2180  RETURN
  190. 2190  COLOR 12:LOCATE 24,10,0:PRINT"* * * Use Shift/PrtSc for a copy of this page. * * *";
  191. 2200  COLOR 0,3:LOCATE 25,20,0:PRINT"  PRESS ANY KEY TO CONTINUE  ";:COLOR 3,0
  192. 2210  A$=INKEY$
  193. 2220  IF A$="" THEN 2210
  194. 2230  LOCATE ,,1
  195. 2240  RETURN
  196. 2250  A=1                                  'search routine
  197. 2260  GET #1,A
  198. 2270  F$=Z1$+Z2$+Z3$+Z4$
  199. 2280  C=INSTR(F$,E$)
  200. 2290  IF Z=2 GOTO 2310
  201. 2300  IF C>0 THEN B=A+1:RETURN ELSE A=A+1:GOTO 2260
  202. 2310  IF Z1$="DONE"+SPACE$(26) THEN B=A:RETURN
  203. 2315  A = A + 1:GOTO 2260
  204. 2320  RETURN
  205. 5000  'ERROR ROUTINE
  206. 5010  IF ERR = 53 THEN LOCATE 15,5,0 :PRINT"SORRY YOU HAVE NO FILES!"
  207. 5020  RESUME 770
  208. 6012  IF A = 2 THEN LOCATE 6,27,1 :PRINT"FILES ON THIS DISK ARE:":FILES "A:*.*"
  209. 6014  PRINT"  TO CREATE A FILE, YOU MUST DEFINE A NEW NAME."
  210. 6016  PRINT"  IT MUST BE LESS THAN 8 CHARACTERS, NO EXTENTION PLEASE."
  211. 6018  INPUT"  WHAT FILENAME DO YOU WANT TO DEFINE ";A$:RETURN
  212.