home *** CD-ROM | disk | FTP | other *** search
/ Shareware Overload / ShartewareOverload.cdr / database / chrchpr2.zip / REFSELCT.CMD < prev    next >
OS/2 REXX Batch file  |  1987-01-06  |  4KB  |  134 lines

  1. * Program REFSELCT - Allows operator to select a subject for program to search
  2. * Program assumes the user has entered each keyword only once for one article
  3. *Store d+':REFERNCE' TO MFILE
  4. Use &MFILE index &MFILE
  5. Select secondary
  6. *Store d+':REFINDEX' to MFILE1
  7. *Store d+':REFINDKW' to MFILE1NDX
  8. USE &MFILE1 index &MFILE1NDX
  9. Erase
  10. @ 1,20 say INH
  11. ?
  12. Store 'JANFEBMARAPRMAYJUNJULAUGSEPOCTNOVDEC' to months
  13. Accept 'Do you want the text displayed with the reference? ' to TEXT:TOO
  14. Store T to moresrch
  15. Do while moresrch
  16. Store T to SRCHCONT
  17. Accept 'Enter a search subject ' to insearch
  18. Store len(insearch) to islen
  19. If !(insearch)='Q' .and. islen=1
  20.   Store F to moresrch
  21.   Store F to srchcont
  22. else
  23.   If len(insearch)=1
  24.     Store F to srchcont
  25.     ? 'Search subject must have at least 2 characters.'
  26.   else
  27.     Store ' ' to SOURCES
  28.     Store ' ' to XAND
  29.     Store ' ' to XXAND
  30.     If $(insearch,islen,1) = '&'
  31.       Store $(insearch,1,islen-1) to insearch
  32.       Accept 'Enter second search subject ' to XAND
  33.       If !(XAND) = 'Q'
  34.         Store F to SRCHCONT
  35.       else
  36.        if len(xand)>1
  37.         Store len(XAND) to IXLEN
  38.         If $(XAND,IXLEN,1)='&'
  39.           ? 'Only one secondary search subject is allowed. "&" is ignored.'
  40.           Store $(XAND,1,ixlen-1) to XAND
  41.         endif
  42.        endif
  43.        Store ' & '+XAND to XXAND
  44.       endif
  45.     endif
  46.     Find &INSEARCH
  47.     If # = 0
  48.       ? 'No match for search subject. '
  49.       Store F to SRCHCONT
  50.     endif
  51.   endif
  52.   If SRCHCONT
  53.   Store '                                ' to inblnk
  54.   @ 6,18 say 'Subject is "'+insearch+XXAND+'"'+'                     '+curdate
  55.   ?
  56.   ?
  57.   Do while keywordndx=insearch
  58.     Store sourcecode to scin
  59.     Select primary
  60.     Find &scin
  61.     If #=0
  62.      ? 'Error in data files. No match in',MFILE,'for index found in',MFILE1,'.'
  63.      ? 'SOURCECODE =',scin
  64.      ?
  65.      Store F to SRCHCONT
  66.     else
  67.      Store F to MATCHED
  68.      * Omit this source if it has been found already from a different keyword.'
  69.      Store '|'+SCIN to SOURCEX
  70.      If @(sourcex,sources)=0
  71.       Store trim(sources)+sourcex to sources
  72.       If XAND<>' '
  73.        Store 1 to incntr
  74.        Store '1' to C
  75.        Store F to MATCHED
  76.        Do while incntr<8 .and. keyw&C<>'  '
  77.         If kEYW&C=XAND
  78.           Store T to MATCHED
  79.           Store 7 to incntr
  80.         endif
  81.         Store incntr+1 to incntr
  82.         Store STR(incntr,1) to C
  83.        enddo
  84.       else
  85.         Store T to matched
  86.       endif
  87.       If MATCHED
  88.        ? keywordndx,'  ',scin
  89.        ? '  ',$(P.title,1,55),P.author
  90.       endif
  91.       If XAND=' ' .or. MATCHED
  92.        If !(TEXT:TOO)='Y'
  93.         Store '  ' to TEXT0
  94.         Store 1 to TXTN
  95.         Store '1' to TX
  96.         Do while text&TX <> '     ' .and. tx<>'0'
  97.           ? '        ',TEXT&TX
  98.           Store txtn+1 to txtn
  99.           If txtn=5
  100.             Store '0' to TX
  101.           else
  102.             Store str(txtn,1) to TX
  103.           endif
  104.         enddo
  105.         ?
  106.        endif
  107.      endif
  108.    endif
  109.   endif
  110.   Select secondary
  111.   SKIP
  112.   enddo
  113.  ?
  114.   Accept 'Another? ' to XX
  115.   If !(XX)<>'Y' .and. XX<>' '
  116.     Store F to moresrch
  117.   endif
  118.   ERASE
  119. endif
  120. enddo
  121. use
  122. select primary
  123. Use
  124. Release nmonth,st,lsep,mfile1,mfile1ndx,months,text:too,moresrch,srchcont,xand
  125. Release xxand,insearch,sources,islen,inblnk,scin,matched,sourcex,text0,txtn,tx
  126. Release C,incntr
  127. RETURN
  128.  
  129.  
  130.  
  131. 3-9386 478 Cinnamon Ridge Dr.   Apple Valley, MN    55124     03/29/50-                     Y            12         C-3                                                         WS,TE,DS,BO,                                                  X                                                1283       Bruns          Dennis        BRUD0021M871-6176 4561 Lyndale Ave S.      Mpls, MN            55473     07/13/47                            3N      6721-3545 C28                                                       to XXAND
  132.     If $(insearch,islen,1) = '&'
  133.       Store $(insearch,1,islen-1) to insearch
  134.       Accept 'Enter second search subject ' to XA