home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.barnyard.co.uk
/
2015.02.ftp.barnyard.co.uk.tar
/
ftp.barnyard.co.uk
/
cpm
/
walnut-creek-CDROM
/
MBUG
/
MBUG061.ARC
/
LIBRARY.DOC
< prev
next >
Wrap
Text File
|
1979-12-31
|
22KB
|
757 lines
LIBRARY CROSS-REFERENCING SYSTEM
Sample
Description of the system:
Thi≤á systeφ allow≤ thσ use≥ t∩ storσ reference≤ t∩á journa∞ ì
article≤ anΣ books¼á alonτ witΦ ß lis⌠ oµ keyword≤ (subjects⌐ fo≥ ì
eacΦá reference«á I⌠ automaticall∙ maintain≤ ß "historyó oµá al∞ ì
thσá keyword≤á tha⌠ arσ iε thσ database«á Ne≈ addition≤á t∩á thσ ì
database¼á anΣ change≤ t∩ thσ database¼á automaticall∙ updatσ thσ ì
keyword≤ database«á Thσ use≥ caε displa∙ ß lis⌠ oµ al∞ availablσ ì
keywords¼á anΣá caεá als∩ searcΦ fo≥ reference≤ tha⌠ contaiεá an∙ ì
given keyword, or group of keywords.
Databases and Index Files:
Thσá maiε databasσ i≤ calleΣ LIBRARY.DAT¼á anΣ i⌠á ha≤á thi≤ ì
structure:
STRUCTURE FOR FILE: B:LIBRARY .DBF
NUMBER OF RECORDS: 00005
DATE OF LAST UPDATE: 00/00/00
PRIMARY USE DATABASE
FLD NAME TYPE WIDTH DEC
001 AUTHOR C 040
002 TITLE C 040
003 PUB C 030
004 DATE C 008
005 PAGES C 008
006 ABSTRACT C 254
007 KEYWORDS C 080
** TOTAL ** 00461
Tw∩ inde° file≤ arσ maintaineΣ a⌠ al∞ times« Thσ firs⌠ maintain≤ ì
aεá alphabetica∞á listinτ b∙ autho≥ anΣ title«á Thi≤á inde°á wa≤ ì
created with the command:
INDEX ON AUTHOR+TITLE TO AUTHORS
Thσ seconΣ inde° maintain≤ ß chronologica∞ order« Sincσ thσ DAT┼ ì
i≤á storeΣ iε MM/DD/Y┘ fashion¼á thσ inde° filσ wa≤ createΣá sucΦ ì
tha⌠á thσ yea≥ i≤ oµ greate≥ importancσ thaε thσ montΦ anΣá date« ì
Hence¼ thi≤ inde° wa≤ createΣ witΦ thσ command:
INDEX ON $(DATE,7,2)+$(DATE,1,5) TO DATES
Thσá seconΣ databasσ maintain≤ ß histor∙ oµ al∞ keyword≤ useΣá iε ì
thσá maiε database¼á a≤ wel∞ a≤ ß counte≥ oµ ho≈ man∙ record≤á iε ì
thσá maiεá databasσá usσá eacΦá keyword«áá Thσá filσá i≤á calleΣ ì
KEYWORDS.DBF¼ anΣ i⌠ has thi≤ structure:
èSTRUCTURE FOR FILE: B:KEYWORDS.DBF
NUMBER OF RECORDS: 00010
DATE OF LAST UPDATE: 00/00/00
PRIMARY USE DATABASE
FLD NAME TYPE WIDTH DEC
001 KEYWORD C 020
002 KEYNO N 004
** TOTAL ** 00025
This file is indexed on the keywords field, using the command:
INDEX ON KEYWORD TO KEYWORDS
Software Structure
The command files are structured as follows:
_______________
| LIBRARY.CMD |
| |
| Main Menu |
|_____________|
|
-------------------------------------------
______|________ __________|_________ ________|______
| LIBADD.CMD | | LREPORTS.CMD | |LIBEDIT.CMD |
| Add new data| | Present sort, | | Allow edits,|
| and update | | search, and | | and update |
| keyword list| | report options, | | the keyword |
_______________ | and print report | | file. |
|__________________| |_____________|
| |
__________|_________ ________|______
| LIBFIND.CMD | | LIBED2.CMD |
| Search for and | | Display Edit|
| display references| | screen and |
| by subject. | | allow edits |
|___________________| |_____________|
User-Interface
Wheε t∩ use≥ call≤ u≡ thσ LIBRAR┘ system¼á i⌠ firs⌠ present≤ ì
the Main Menu, as below:
Library System Main Menu
1. Add new references
2. Print Reports
3. Edit References
4. Exit
Enter choice (1-4)
è Iµá thσ use≥ wishe≤ t∩ AdΣ ne≈ references¼á hσ i≤á presenteΣ ì
with a custom "APPEND" screen, as below:
Record No. 1 Enter new Data, ^Q to Quit
----------------------------------------------------------
Author: :
Title : :
Pub. : :
Date : : : Pages : :
Abstract:
:
Keyword 1 : :
Keyword 2 : :
Keyword 3 : :
Keyword 4 : :
Keyword 5 : :
Keyword 6 : :
Keyword 7 : :
---------------------------------------------------------
Iµ thσ use≥ want≤ t∩ Prin⌠ Reports¼á thσ screeε ask≤ iµá hσ ì
wishe≤á t∩á prin⌠á keyword≤ o≥ references«á Iµ thσá use≥á selec⌠ ì
keywords¼á theε thσ keyworΣ filσ i≤ displayed¼ alphabetically¼ iε ì
two columns, as below:
BANK PERFORMANCE
DBASE II PRIMARY
DISK DRIVES ROBBERS
DOG BISCUITS SECONDARY
MULTIPLE FILES UPDATE
If the user wishes to see references, the screen first asks:
How do you want references sorted?
1. Alphabetically by Author
2. Chronologically by Date
3. Original Order
Then¼á thσ use≥ caε typσ iε thσ subject≤ hσ wishe≤ t∩ searcΦ for¼ ì
in a screen as below:
Keyword 1 : :
Keyword 2 : :
Keyword 3 : :
Keyword 4 : :
Keyword 5 : :
Keyword 6 : :
Keyword 7 : :
è
Iµá thσá use≥ request≤ t∩ searcΦ oε morσ thaεá onσá keyword¼á thσ ì
screeε ask≤ iµ thσ use≥ want≤ reference≤ witΦ AL╠ o≥ AN┘ keyword« ì
Then¼á thσá appropriatσá reference≤ arσ displayeΣ iεá thσá forma⌠ ì
below:
Author: Blaine, Appy
Title : Dog Biscuits in your Disk Drives
Pub. : Data Based Advisor
Date : 01/01/83 Pages : 12-345
Keywords : DBASE II, DISK DRIVES, DOG BISCUITS,
Abstract :
A complete listing of items not to put into your disk
drives. Includes mention of those sticky little yellow
"Post-It" pads, which tend to disable drive B on many
computers. However, dog biscuits are the ultimates no-no
for putting into floppy drives.
Edit≤á arσ handleΣ b∙ askinτ thσ use≥ fo≥ thσ las⌠á namσá oµ ì
thσá maiε autho≥ oµ thσ referencσ t∩ edit«á Iµ therσ i≤ n∩á sucΦ ì
author¼ thσ use≥ i≤ tolΣ so« Iµ therσ arσ numerou≤ reference≤ b∙ ì
thi≤á author¼á theε thosσ arσ displayeΣ anΣ thσ use≥ i≤ askeΣá t∩ ì
selec⌠á b∙ recorΣ number«á Oncσ thσ referencσ t∩ edi⌠ i≤á found¼ ì
thσá referencσá i≤á displayeΣ oε thσ screeε iε exactl∙á thσá samσ ì
forma⌠ a≤ thσ APPEN─ format¼ anΣ thσ use≥ caε makσ changes.
Program Listings
The programs used in the LIBRARY system are displayed below:
********************************** LIBRARY.CMD
******************** Library System Main Menu.
******************** The LIBRARY System maintains
******************** a history and count of all
******************** keywords used in the LIBRARY
******************** database.
SET TALK OFF
SET DEFA TO B
STORE 0 TO CHOICE
*************************** Display Main Menu.
DO WHILE CHOICE <> 4
ERASE
TEXT
Library System Main Menu
1. Add new references
2. Print Reports
3. Edit References
4. Exitè ENDTEXT
INPUT " Enter choice (1-4) " TO CHOICE
**************** Branch to appropriate procedure
**************** based upon choice.
DO CASE
CASE CHOICE = 1
DO LIBADD
CASE CHOICE = 2
DO LREPORTS
CASE CHOICE = 3
DO LIBEDIT
ENDCASE
ENDDO (while choice # 4)
Here is LIBADD.CMD, used for adding new records.
*************************************** LIBADD.CMD
*************************************** Add new data.
************** Open Data Files
SELECT PRIMARY
USE LIBRARY INDEX AUTHORS,DATES
SELECT SECONDARY
USE KEYWORDS INDEX KEYWORDS
SET EXACT ON
************** Initialize memory variables.
STORE " " TO K1,K2,K3,K4,K5,K6,K7
SELECT PRIMARY
GO BOTT
DO WHILE AUTHOR <> " " .OR. # <= 1
************ Display custom APPEND screen, (which
************ was created with ZIP).
ERASE
APPEND BLANK
@ 1, 3 SAY "Record No. "+STR(#,3)+" Enter new Data, ^Q to Quit"
@ 2, 0 SAY "--------------------------------------------------"
@ 2,50 SAY "------------------------------"
@ 4, 3 SAY "Author"
@ 4,12 GET AUTHOR
@ 5, 3 SAY "Title"
@ 5,12 GET TITLE
@ 6, 3 SAY "Pub."
@ 6,12 GET PUB
@ 7, 3 SAY "Date"
@ 7,12 GET DATE PICT "99/99/99"è @ 7,26 SAY "Pages"
@ 7,32 GET PAGES
@ 9, 3 SAY "Abstract"
@ 9,12 GET ABSTRACT
@ 13, 3 SAY "Keyword 1"
@ 13,13 GET K1
@ 14, 3 SAY "Keyword 2"
@ 14,13 GET K2
@ 15, 3 SAY "Keyword 3"
@ 15,13 GET K3
@ 16, 3 SAY "Keyword 4"
@ 16,13 GET K4
@ 17, 3 SAY "Keyword 5"
@ 17,13 GET K5
@ 18, 3 SAY "Keyword 6"
@ 18,13 GET K6
@ 19, 3 SAY "Keyword 7"
@ 19,13 GET K7
@ 21, 0 SAY "--------------------------------------------------"
@ 21,50 SAY "------------------------------"
READ
****************** ONLY perform this step if not exiting this program.
IF AUTHOR <> " "
****************** Update the Keyword File.
SELECT SECONDARY
STORE " " TO TEMPKEY
STORE 1 TO COUNT
STORE STR(COUNT,1) TO MAC
DO WHILE K&MAC <> " " .AND. COUNT < 8
STORE !(K&MAC) TO K&MAC
FIND &K&MAC
IF # > 0
REPLACE KEYNO WITH KEYNO+1
ELSE
APPEND BLANK
REPLACE KEYWORD WITH K&MAC
REPLACE KEYNO WITH 1
ENDIF (# > 0)
*** Put keyword into temporary TEMPKEY string.
STORE TEMPKEY+TRIM(K&MAC)+", " TO TEMPKEY
**** Clear out K&MAC memory variables, and increment count.
STORE " " TO K&MAC
STORE COUNT +1 TO COUNT
STORE STR(COUNT,1) TO MAC
ENDDO (k&mac<>" ")
ENDIF [not exiting this program (author <> "")]
SELECT PRIMARYè*********************** Put tempkey into keywords on Primary file.
REPLACE KEYWORDS WITH TEMPKEY
ENDDO (while author <> " ")
*********************** Get rid of any "blank" records.
DELETE ALL FOR AUTHOR = " " .AND. TITLE = " "
PACK
*********************** Return to Main Menu.
SET EXACT OFF
RETURN
LREPORTS, below, presents options for, and prints reports.
**************************** LREPORTS.CMD
********** Asks user if they want keyword
********** listing or to search references
********** By subjects. Provides the keyword
********** listing, branches to LIBFIND for
********** search by subject.
ERASE
STORE " " TO RCHOICE
@ 5,10 SAY " Which Report do you want "
@ 7, 5 SAY "1. Keyword Listing"
@ 8, 5 SAY "2. References by Subject"
@ 10,8 SAY "Enter choice (1-2) " GET RCHOICE
READ
*********** Do appropriate report based upon user's request.
DO CASE
CASE RCHOICE = "1"
******* Ask about hardcopy
ERASE
STORE " " TO LP
@ 5,10 SAY " Send Keywords to printer (Y/N) " GET LP
READ
IF !(LP)="Y"
*SET PRINT ON
ENDIF (lp=y)
*********** print keywords in two alphabetized columns.
ERASE
USE KEYWORDS
GO BOTT
STORE (#+1)/2 TO MIDDLE
STORE 1 TO COUNTER
USE KEYWORDS INDEX KEYWORDS
STORE "Y" TO OK
DO WHILE COUNTER <= MIDDLE .AND. !(OK)="Y" è ? KEYWORD
SKIP MIDDLE
IF .NOT. EOF
?? KEYWORD
SKIP -1*MIDDLE-1
ENDIF (not eof)
STORE COUNTER + 1 TO COUNTER
************** If keyword list going to the screen,
************** Pause every 20 lines.
IF COUNTER/20 = INT(COUNTER/20) .AND. !(LP) <> "Y"
?
?
? " Continue? (Y/N) "
WAIT TO OK
ENDIF (counter/20 and not lp)
************* If keyword list going to the
************* printer, eject page every 60 lines.
IF COUNTER/60 = INT(COUNTER/60) .AND. !(LP) = "Y"
EJECT
ENDIF (counter/60 and lp)
ENDDO (counter and ok)
************* If keyword list going to the screen, pause
************* before returning to the main menu.
IF !(LP) <> "Y"
?
?
? " Press any key to return to main menu..."
WAIT
ENDIF (lp <> y)
CASE RCHOICE = "2"
DO LIBFIND
ENDCASE
RETURN
Thσá LIBFIN─á commanΣ filσ fin≤ anΣ display≤á record≤á tha⌠á havσ ì
subjects in common.
è
*********************************** LIBFIND.CMD
********** Pull out records with certain subjects.
********** First, ask for sort order.
ERASE
STORE 1 TO ORDER
?
? " How do you want references sorted? "
?
? " 1. Alphabetically by Author "
? " 2. Chronologically by Date"
? " 3. Original Order"
@ 9,4 SAY "Enter choice (1-3) " GET ORDER PICT "9"
READ
*********** Use appropriate index.
DO CASE
CASE ORDER = 1
USE LIBRARY INDEX AUTHORS
CASE ORDER = 2
USE LIBRARY INDEX DATES
CASE ORDER = 3
USE LIBRARY
OTHERWISE
RETURN
ENDCASE
************************* Next, get search criteria.
ERASE
STORE " " TO K1,K2,K3,K4,K5,K6,K7,K8
@ 3,5 SAY "Keyword 1 " GET K1
@ 4,5 SAY "Keyword 2 " GET K2
@ 5,5 SAY "Keyword 3 " GET K3
@ 6,5 SAY "Keyword 4 " GET K4
@ 7,5 SAY "Keyword 5 " GET K5
@ 8,5 SAY "Keyword 6 " GET K6
@ 9,5 SAY "Keyword 7 " GET K7
READ
*********************** Count how many keywords to search on.
*********************** and store to the variable kcount.
STORE 0 TO KCOUNT
STORE "1" TO MAC
DO WHILE K&MAC <> " "
STORE KCOUNT+1 TO KCOUNT
STORE STR(KCOUNT+1,1) TO MAC
ENDDO
è
************** Now, set up search condition into
************** a memory variable called CND.
************** First, set up initial search condition.
STORE CHR(34)+" "+!(TRIM(K1))+","+CHR(34)+" $KEYWORDS" TO CND
************** If many keywords to search on,
************** ask about the logic of the search.
STORE "0" TO LOGIC
IF KCOUNT > 1
?
@ 12,2 SAY " References with 1) ALL keywords or 2) ANY keyword " GET LOGIC
READ
IF LOGIC = "1"
STORE " .AND. " TO LOGIC
ELSE
STORE " .OR. " TO LOGIC
ENDIF (logic=1)
*********** Then finish the 'condition' string (CND).
STORE 2 TO COUNT
DO WHILE COUNT <= KCOUNT
STORE STR(COUNT,1) TO MAC
STORE CND+LOGIC+CHR(34)+" "+!(trim(K&MAC))+","+CHR(34)+;
" $KEYWORDS" TO CND
STORE COUNT+1 TO COUNT
ENDDO (count <=kcount)
ENDIF (kcount > 1)
*********** Ask about hardcopy.
ERASE
STORE " " TO LP
@ 5,5 SAY " Send report to printer (Y/N) " GET LP
READ
************ Prepare printer if necessary.
IF !(LP)="Y"
@ 7,5 SAY "Ready printer, then press any key..."
WAIT
SET PRINT ON
ENDIF (LP = Y)
************ Use LF to count line-feeds for formatting
************ On the screen and printer.
STORE 0 TO LF
************ Finally, print the report, listing only
************ references for whom &CND is true.
ERASE
DO WHILE .NOT. EOF
IF &CNDè ? "Author:",AUTHOR
? "Title :",TITLE
? "Pub. :",PUB
? "Date :",DATE," Pages : ",PAGES
?
? "Keywords : "+KEYWORDS
? "Abstract : "
STORE LF+7 TO LF
****************** Break off long abstract at space
****************** Nearest the right margin.
STORE TRIM(ABSTRACT) TO STRING
STORE LEN(TRIM(STRING)) TO TLEN
DO WHILE TLEN > 60
**************** Find space nearest right margin
STORE 60 TO SPOT
DO WHILE $(STRING,SPOT,1)<>" "
STORE SPOT-1 TO SPOT
ENDDO (while not " ")
**************** Print sub-string and break off section.
? $(STRING,1,SPOT-1)
STORE LEN(TRIM(STRING))-SPOT TO TLEN
STORE $(STRING,SPOT+1,TLEN) TO STRING
STORE LF+1 TO LF
ENDDO (while len > 60)
? STRING
?
?
STORE LF+3 TO LF
************* Count line feeds, and start on
************* new page, if necessary.
IF LF >= 55
EJECT
STORE 0 TO LF
ENDIF (lf > 55)
ENDIF (cnd)
SKIP
ENDDO (while not eof)
SET PRINT OFF
USE
RETURN
LIBEDIT prepares for editing, and manages keyword file updates.
***************************** LIBEDIT.CMD
************* Allows user to look up a reference
************* by primary author name, and change
************* data. Automatically updates the
************* keyword history file.
************* Set up databases and memory variables.
SELE PRIMèUSE LIBRARY INDEX AUTHORS,DATES
SELE SECO
USE KEYWORDS INDEX KEYWORDS
SELE PRIM
STORE " " TO K1,K2,K3,K4,K5,K6,K7
************** Find out who to edit.
ERASE
?
ACCEPT " Enter Main Author's last name " TO SEARCH
STORE !(SEARCH) TO SEARCH
ERAS
*************** Determine if 0, 1 or many references
*************** By this author, and react accordingly.
FIND &SEARCH
STORE 0 TO HOWMANY
COUNT WHILE !(AUTHOR) = SEARCH TO HOWMANY
DO CASE
CASE HOWMANY = 0
STORE 0 TO RECNO
?
? " There is no &SEARCH on the database."
?
WAIT
CASE HOWMANY = 1
FIND &SEARCH
STORE # TO RECNO
CASE HOWMANY > 1
FIND &SEARCH
LIST WHILE LNAME = &SEARCH AUTHOR, TITLE, PUB
?
INPUT " Which one (by number) " TO RECNO
ENDCASE
*********** Edit appropriate record, if recno > 0
ERASE
IF RECNO > 0
GOTO RECNO
*************** Peel out individual keywords from
*************** the long KEYWORDS field in the
*************** library database.
STORE 2 TO START
STORE 1 TO COUNT
STORE KEYWORDS TO TEMP
DO WHILE "," $(KEYWORDS)è STORE STR(COUNT,1) TO SCOUNT
STORE $(KEYWORDS,START,@(",",KEYWORDS)-2) TO K&SCOUNT
REPLACE KEYWORDS WITH $(KEYWORDS,@(",",KEYWORDS)+1,50)
STORE COUNT+1 TO COUNT
ENDDO (while "," $keywords)
************* just in case user deletes any or all
************* keywords, subtract 1 from the total number
************* of references for this keyword from
************* The keywords file.
SELE SECO
STORE 1 TO X
STORE "1" TO MAC
DO WHILE K&MAC <> " "
FIND &K&MAC
REPLACE KEYNO WITH KEYNO-1
STORE X+1 TO X
STORE STR(X,1) TO MAC
ENDDO
****** Now branch to LIBED2 to do the edit.
****** (LIBED2 is stolen from the LIBADD command file.)
SELE PRIM
DO LIBED2
ENDIF (recno > 0)
**************** Before returning to main menu,
**************** Eliminate any keywords for which there
**************** are no references
ERASE
? " Updating keyword file.........."
SELE SECO
DELE ALL FOR KEYNO=0
PACK
RETURN
LIBED▓á i≤ aε extensioε oµ LIBED¼á anΣ handle≤ thσ actua∞á screeε ì
display in editing data. It is mostly a clone of LIBADD.
**************************************** LIBED2.CMD
**************************** Allow user to edit reference,
**************************** then re-update keywords file.
*************** (This command file was created by "borrowing"
*************** a portin of LIBADD.CMD, and modifying).
ERASE
@ 1, 3 SAY "Record No. "+STR(#,3)
@ 2, 0 SAY "--------------------------------------------------"
@ 2,50 SAY "------------------------------"
@ 4, 3 SAY "Author"
@ 4,12 GET AUTHOR
@ 5, 3 SAY "Title"
@ 5,12 GET TITLEè@ 6, 3 SAY "Pub."
@ 6,12 GET PUB
@ 7, 3 SAY "Date"
@ 7,12 GET DATE PICT "99/99/99"
@ 7,26 SAY "Pages"
@ 7,32 GET PAGES
@ 9, 3 SAY "Abstract"
@ 9,12 GET ABSTRACT
@ 13, 3 SAY "Keyword 1"
@ 13,13 GET K1
@ 14, 3 SAY "Keyword 2"
@ 14,13 GET K2
@ 15, 3 SAY "Keyword 3"
@ 15,13 GET K3
@ 16, 3 SAY "Keyword 4"
@ 16,13 GET K4
@ 17, 3 SAY "Keyword 5"
@ 17,13 GET K5
@ 18, 3 SAY "Keyword 6"
@ 18,13 GET K6
@ 19, 3 SAY "Keyword 7"
@ 19,13 GET K7
@ 21, 0 SAY "--------------------------------------------------"
@ 21,50 SAY "------------------------------"
READ
****************** Update Keyword File.
SELECT SECONDARY
STORE " " TO TEMPKEY
STORE 1 TO COUNT
STORE STR(COUNT,1) TO MAC
DO WHILE K&MAC <> " " .AND. COUNT < 8
STORE !(K&MAC) TO K&MAC
FIND &K&MAC
IF # > 0
REPLACE KEYNO WITH KEYNO+1
ELSE
APPEND BLANK
REPLACE KEYWORD WITH K&MAC
REPLACE KEYNO WITH 1
ENDIF (# > 0)
*** Now, concatentate K&MAC into temporary KEYWORDS string.
STORE TEMPKEY+TRIM(K&MAC)+", " TO TEMPKEY
STORE COUNT +1 TO COUNT
STORE STR(COUNT,1) TO MAC
ENDDO (k&mac<>" ")
*********************** Put tempkey into keywords
SELECT PRIMARY
REPLACE KEYWORDS WITH TEMPKEY
RETURN