	REM ------------ FILE BIBLIO.BAS

	REM           ******** FUZZY BIBLIOGRAPHIC SEARCH *******
	REM           *   Written by: Thomas A. Smith           *
	REM           *             1525 Lyndhurst Ave.         *
	REM           *             Camarillo, CA  93010        *
	REM           *******************************************

        REM  Edited by Joe Butler 05 18 83 for CBUG

	REM MAIN DRIVER AND MENU

	REM SET UP COMMON FOR CHAINING
%CHAIN 40,4000,0,624
	COMMON KEYWD$(1),LIBNAME$,RLEN%,TRUE%,AUTH.LEN%,TITL.LEN%
	COMMON MAXBIB%,MAXDESC%,MAXDEF%,MAXKEYS%,MAXCON%,CONCEPT$(1)
	COMMON ISS.LEN%,CLEAR$,ERR%,JOUR.LEN%,KWD.LEN%,CMD$(1)
	COMMON LFT%(1),RGHT%(1),CON.KEY%(2),CON.RATE(2),QUERY$,L%

	REM INITIALIZE
	IF LEN(LIBNAME$)=0 THEN LIBNAME$=COMMAND$
	CLEAR$=CHR$(126)+CHR$(28) : TRUE%=-1
	PRINT CLEAR$
	IF LEN(LIBNAME$)=0 THEN \
           INPUT "PLEASE ENTER LIBRARY NAME:  ";LINE LIBNAME$

	REM IF NO DEFINITIONS ON FILE GO TO DEFINITION MODULE
	IF END #3 THEN 14
	OPEN LIBNAME$+".DEF" AS 3
	IF SIZE(LIBNAME$+".DEF")=0 THEN DELETE 3 : CHAIN "PARMS"
	GOTO 13

14      CHAIN "PARMS"

13      REM OTHERWISE READ DEFINITIONS
	IF END #3 THEN 12
	READ #3;    \
	MAXKEYS%,   \              REM MAX NUMBER KEYWORDS IN VOCABULARY
	MAXDESC%,   \              REM MAX KEYWORDS PER BIBLIO ARTICLE
	MAXDEF%,    \              REM MAX KEYWORDS PER CONCEPT DEFINTITON
	MAXCON%,    \              REM MAX NUMBER OF CONCEPTS PER QUERY
	MAXBIB%,    \              REM MAX NUMBER ARTICLES IN BIBLIO FILE
	AUTH.LEN%,  \              REM AUTHOR NAME FIELD LENGTH
	TITL.LEN%,  \              REM ARTICLE TITLE FIELD LENGTH
	JOUR.LEN%,  \              REM JOURNAL NAME FIELD LENGTH
	ISS.LEN%,   \              REM ISSUE IIDENTIFIER FIELD LENGTH
	KWD.LEN%    \              REM KEYWORD FIELD LENGTH

12      CLOSE 3

        REM TOTAL ARTICLE RECORD LENGTH
	RLEN%=AUTH.LEN%+JOUR.LEN%+ISS.LEN%+TITL.LEN%+3*(MAXDESC%+1)+2
	DIM KEYWD$(MAXKEYS%)

	REM DISPLAY MENU AND GET SELECTION
  	PRINT CLEAR$ : PRINT
  	PRINT TAB(12);"-------------BIBLIOGRAPHY SEARCH-----------------"
  	PRINT
  	PRINT TAB(12); "1    BUILD/MODIFY BIBLIOGRAPHY"
  	PRINT TAB(12); "2    BUILD/MODIFY KEYWORD VOCABULARY"
  	PRINT TAB(12); "3    LIST KEYWORD VOCABULARY WORDS"
  	PRINT TAB(12); "4    SEARCH BIBLIOGRAPHY FILE"
  	PRINT TAB(12); "5    COMPRESS BIBLIOGRAPHYY FILE"
  	PRINT TAB(12); "6    DONE--EXIT TO SYSTEM"
  	OPT%=7 : PRINT : PRINT
  	WHILE (OPT%>6) OR (OPT%<1)
  	INPUT "PLEASE SELECT DESIRED FUNCTION BY NUMBER: ";OPT%
  	IF (OPT%>6) OR (OPT%<1) THEN PRINT "ILLEGAL FUNCTION NUMBER--REENTER"
    	WEND

	REM EXECUTE SELECTED FUNCTION
  	IF OPT%=6 THEN PRINT CLEAR$:STOP
  	IF OPT%=1 THEN CHAIN "BIBBLD"
  	IF OPT%=2 THEN CHAIN "VOCBLD"
  	IF OPT%=3 THEN CHAIN "VOCLST"
  	IF OPT%=4 THEN CHAIN "BIBSRCH"
  	IF OPT%=5 THEN CHAIN "CMPRBIB"
	STOP

