home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
CP/M
/
CPM_CDROM.iso
/
mbug
/
mbug061.arc
/
LIBFIND.CMD
< prev
next >
Wrap
OS/2 REXX Batch file
|
1979-12-31
|
4KB
|
167 lines
*********************************** 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
d? "
?
? " 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
U