	REM------FILE PARMS.BAS

	REM PROGRAM PARAMETER DEFINITION MODULE
	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%
	DIM SPARM%(4)

	SPACE%=FRE
	SPACE%=SPACE%-4000

10      PRINT CLEAR$
	PRINT TAB(2);"----PARAMETER DEFINITION FOR ";
	PRINT LIBNAME$;"----":PRINT
	PRINT \
           "THIS MODULE WILL DEFINE THE PARAMETERS FOR THE LIBRARY "; LIBNAME$
	INPUT "IF YOU DO NOT WISH TO PROCEED ENTER S ELSE ENTER C: "; LINE ANS$
	IF UCASE$(LEFT$(ANS$,1))<>"C" THEN STOP
	PRINT \
	   "** FIRST WE DEFINE THE ARTICLE RECORD FIELD SIZES **"

12      PRINT \
	   "YOU HAVE A MAXIMUM OF 250 CHARACTERS THAT MAY BE ALLOCATED"
	PRINT \
	   "FOR  EACH ARTICLE RECORD.  EACH KEYWORD DESCRIPTOR ATTACHED"
	PRINT "WILL CONSUME THREE OF THESE."
	INPUT \
	   "WHAT IS THE MAXIMUM NUMBER OF DESCRIPTORS PER ARTICLE? ";MAXDESC%
	PRINT USING "YOU HAVE ### CHARACTERS REMAINING."; 250-3*MAXDESC%

13 	PRINT \
	   "ENTER MAXIMUM FIELD LENGTHS, IN ORDER, FOR AUTHOR, TITLE,"
	PRINT \
	   "JOURNAL, AND ISSUE---ALL ON ONE LINE,  SEPERATE ENTRIES BY"
	PRINT \
 	   "ONE OR MORE SPACES AND FOLLOW LAST ENTRY WITH RETURN."
	GOSUB 100
	IF V%<>5 THEN \
  	   PRINT "INCORRECT NUMBER OF ENTRIES -- RE-ENTER": \
  	GOTO 13
	AUTH.LEN%=SPARM%(1) : TITL.LEN%=SPARM%(2)
	JOUR.LEN%=SPARM%(3) : ISS.LEN% =SPARM%(4)
	RLEN%=AUTH.LEN%+TITL.LEN%+JOUR.LEN%+ISS.LEN%
	RLEN%=RLEN%+3*(MAXDESC%+1)+2
	IF RLEN%>255 THEN \
  	   PRINT USING "RECORD CONTAINS ##### CHARACTERS"; RLEN%-5 : \
  	   PRINT "THE MAXIMUM IS 250 --PLEASE RE-DEFINE FIELDS" : \
  	   GOTO 12

	PRINT CLEAR$
	PRINT "** NOW WE SET THE MAXIMUM SIZES OF OTHER PARAMETERS **"

40      PRINT "ENTER, IN ORDER, THE MAX TO BE ALLOWED FOR :"
	PRINT "CHARS PER KEYWORD, NO. OF KEYWORDS IN VOCABULARY (<256)"
	PRINT "NO. CONCEPTS PER INTERROGATION, NO. KEYWORDS PER CONCEPT."
	PRINT "SEPARATE ENTRIES BY SPACES AND FOLLOW LAST WITH RETURN."
	GOSUB 100
	IF V%<>5 THEN PRINT "INCORRECT NUMBER OF ENTRIES -- RE-ENTER" : \
  	   GOTO 40
	KWD.LEN%= SPARM%(1)  : MAXKEYS%=SPARM%(2)
	MAXCON% = SPARM%(3)  : MAXDEF% =SPARM%(4)
	IF MAXKEYS%>255 THEN MAXKEYS%=255
	INPUT "CAPACITY OF ONE SIDE OF ONE DISK (KILOBYTES): ";D.CAP
	KY.FIL%=2*MAXKEYS%*(KWD.LEN%+2)
	KY.FIL%=1024*(INT%(KY.FIL%/1024)+1)
	D.CAP=(1000*D.CAP-1024-KY.FIL%)/RLEN%:D.CAP=D.CAP-1
	RL%=8*(MAXCON%+1)*(MAXDEF%+2)
	IN%=2*(MAXCON%+1)*(MAXDEF%+1) + 4*(MAXCON%+1)
	ST%=(MAXKEYS%+1)*KWD.LEN%
	MEM%=(SPACE%-RL%-IN%-ST%)/2
	PRINT USING "YOU HAVE DISK SPACE FOR ###### ARTICLES. "; D.CAP
	PRINT USING "YOU HAVE MEMORY SPACE FOR ###### ARTICLES. "; MEM%
	IF MEM%<D.CAP THEN MSPACE=MEM% ELSE MSPACE=D.CAP
	PRINT USING "###### ARTICLES IS THE MAXIMUM YOU MAY HAVE. "; MSPACE
	INPUT \
	    "DO YOU WISH TO RE-ALLOCATE THE AVAILABLE SPACE (Y/N?) ";LINE ANS$
	IF UCASE$(LEFT$(ANS$,1))="Y" THEN 10
	INPUT "MAXIMUM NO. OF ARTICLES DESIRED: ";MAXBIB%
	IF MAXBIB%>MSPACE THEN MAXBIB%=MSPACE

	CREATE LIBNAME$+".DEF" AS 1
	PRINT #1;MAXKEYS%,MAXDESC%,MAXDEF%,MAXCON%, \
  		 MAXBIB%,AUTH.LEN%,TITL.LENS%,JOURN.LEN%,ISS.LEN%, KWD.LEN%
	CLOSE 1
	CHAIN "BIBLIO"

100     INPUT "> ";LINE DUM$ :  I%=1 : V%=1
	WHILE (I%<LEN(DUM$)) AND (V%<5)
  	WHILE MID$(DUM$,I%,1)=" " : I%=I%+1 : WEND
	SPARM%(V%)=VAL(RIGHT$(DUM$,LEN(DUM$)-I%+1))
	V%=V%+1
	WHILE (MID$(DUM$,I%,1)<>" ") AND (I%<LEN(DUM$)):I%=I%+1:WEND
	WEND
	RETURN

