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

  1. * Program CLIBRARY - Controls all CLIBRARY program operations
  2. Clear
  3. Set talk off
  4. Set bell off
  5. Set intensity off
  6.   Store 'January  February March    April    May      June     ' to XX
  7.   Store XX+'July     August   SeptemberOctober  November December ' to MONTHS
  8.   If $(DATE(),7,2) = '00'
  9.     Set date to 01,01,00
  10.   ENDIF
  11.   Store ' ' to curmonthx
  12.   Store ' ' to curyear
  13.   Store ' ' to curmonth
  14.   * Set today's date from current system-date
  15.   Store $(date(),1,2) to curmo
  16.   Store $(date(),7,2) to curmonthx
  17.   Store val(curmo) to nmonth
  18.   Store curmo+curmonthx to indate
  19.   If $(date(),4,1) = '0'
  20.     Store $(DATE(),5,1) to CURMONTHX
  21.   else
  22.     Store $(DATE(),4,2) to CURMONTHX
  23.   endif
  24.   Store trim($(months,NMONTH*9-8,9)) to curmonth
  25.   Store curmonth+' '+curmonthx to curmonthx
  26.   Store ', 19'+$(DATE(),7,2) to CURYEAR
  27.   Store curmonthx+curyear to curdate
  28.   release curmo,months,curyear,curmonthx,nmonth
  29. Select secondary
  30. Use UDIRFILE
  31. GOTO 2
  32. Store !($(spact,21,1)) to D
  33. Store D+':CLIBRARY' to MFILE
  34. Store T to LEVEL1
  35. Do while LEVEL1
  36.   Use
  37.   Select primary
  38.   Use
  39.   Erase
  40.   @ 1,1 say 'DATA DISK = '+D
  41.   @ 1,60 say curdate
  42.   @ 2,20 SAY '    C L I B R A R Y                        2-/CLIBRARY/'
  43.   @ 5,13 say ' Makes and Recalls Book Article Summaries '
  44.   @ 7,9 say  ' 1)  Enter new Book Articles                          /REFERNTR/'
  45.   @ 8,9 say  ' 2)  Recall Books by a selected SUBJECT               /REFSELCT/'
  46.   @ 9,9 SAY  ' 3)  Books Library REPORTS                            /REFREPTS/'
  47.   @ 10,9 say ' 4)  Display the Book Library Subject INDEX           /REFDXLST/'
  48.   @ 11,9 say ' 5)  Display the Book Library Codes-Names        '
  49.   @ 12,9 say ' 6)  Update the Library Codes/Names                   /REFCODES/'
  50.   @ 13,9 say ' 7)  Change/Delete an existing Library Name           /REFCHNGE/'
  51.   @ 14,9 say ' 8)  SET UP'                                  '
  52. ?
  53. Accept '         Enter selection' to MSEL
  54. ?
  55. If !(MSEL)='DISK='
  56.   If len(MSEL)>5
  57.     Store !($(msel,6,1)) to D
  58.     ? 'Disk now being set to drive',D
  59.     Store D+':CLIBRARY' to MFILE
  60.   endif
  61.   Store 'D' to MSEL
  62. endif
  63. Do while @(MSEL,'12345678QqD')=0
  64.   Accept 'Invalid entry. Please enter again ' to MSEL
  65. enddo
  66. If msel<>'8'.and.!(msel)<>'Q'
  67.   If file(MFILE)
  68.     Use &MFILE index &MFILE
  69.   else
  70. ? 'File',mfile,'does not exist on the data disk.  Perform SET UP to create it.'
  71. ?
  72.   endif
  73. endif
  74. Do CASE
  75.     CASE MSEL = '1'
  76.       Store 'CLIBRARY - New Book Article Entry' to INH
  77.       Store D+':CLIBRARY' to MFILE
  78.       Store D+':CLIBINDX' to mfile1
  79.       Store D+':CLIBINKW' to MFILE3
  80.       Do REFERNTR.CMD
  81.       Store T to validd1
  82.     CASE MSEL = '2'
  83.       Store 'CLIBRARY Book Subject Search' to INH
  84.       Store D+':CLIBRARY' to MFILE
  85.       Store D+':CLIBINDX' to MFILE1
  86.       Store D+':CLIBINKW' to MFILE1NDX
  87.       Do REFSELCT.CMD
  88.     CASE MSEL = '3'
  89.       Store 'CLIBRARY Book' to INH
  90.       Store D+':CLIBRARY' to MFILE
  91.       Do CLIBREPT.CMD
  92.     CASE MSEL = '4'
  93.       Store 'CLIBRARY - Book Article Reference/Publication INDEX list  ' to INH
  94.       Store D+':CLIBINDX' to MFILE
  95.       STore D+':CLIBINKW' to MFILENDX
  96.       Do REFDXLST.CMD
  97.     CASE MSEL = '5'
  98. Select primary
  99. Use
  100. Select secondary
  101. Store d+':CLIBINDX' to MFILE
  102. Store '~~~' to inx
  103. Use &MFILE index &MFILE
  104. Store # to LTOP
  105. Store '~' to XX
  106.     GOTO bottom
  107.     Do while * .and. sourcecode<>inx .and. sourcecode=XX
  108.       SKIP -1
  109.     enddo
  110.     If sourcecode<>XX
  111.       ? 'No Reference/Publication codes present in the code file.'
  112.     else
  113.         ? 'Book Library Reference/Publication code list   ',curdate
  114.         ?
  115.       If #=LTOP
  116.         ? $(sourcecode,2,2),' :  ',$(keywordndx,2,19)
  117.       else
  118.       Do while sourcecode=XX.and.#<>LTOP
  119.         ? $(sourcecode,2,2),' :  ',$(keywordndx,2,19)
  120.         SKIP -1
  121.         Do while * .and. sourcecode<>inx .and. sourcecode=XX
  122.           SKIP -1
  123.         enddo
  124.       enddo
  125.       endif
  126.     endif
  127. USE
  128. ?
  129. ?
  130. Accept 'End of Book Library Reference/Pub. codes. Press <retn> ' to XX
  131. Select primary
  132. Release ST,inx,xx
  133.     CASE MSEL = '6'
  134.       Store D+':CLIBINDX' to MFILE
  135.       Store D+':CLIBINKW' to MFILENDX
  136. Store 'CLIBRARY Book Reference / Publication code entry routine.' to INH
  137.       Do REFCODES.CMD
  138.     CASE MSEL = '7'
  139.       Store D+':CLIBINDX' to MFILENDX
  140.       Store D+':CLIBINKW' to MFILENX
  141.       Store D+':CLIBRARY' to MFILE
  142.       Store 'CLIBRARY Book Article Change routine.' to INH
  143.       Do REFCHNGE.CMD
  144.     CASE MSEL = '8'
  145. ?
  146. ? '                   CLIBRARY  SET UP'
  147. ?
  148. ? '         1) Build new Library files'
  149. ? '         2) Re-index existing Library files'
  150. ? '         3) Names Directory editing'
  151. ?
  152. Accept '         Enter selection ' to XX
  153. ?
  154. If XX='1'
  155. Accept ;
  156. 'Now about to build new Library files: CLIBRARY.DBF and CLIBINDX.DBF.  OK? ' ;
  157. to XX
  158. If !(XX)='Y'
  159. Use REFERNCX
  160. ? 'Now creating CLIBRARY.DBF file with index = CLIBRARY.NDX'
  161. Store d+':CLIBRARY' to MFILE
  162. Copy to &MFILE
  163. USE &MFILE
  164. Index on sourcecode to &MFILE
  165. Use refindxx
  166. ? 'Now creating CLIBINDX.DBF file for keywords,'
  167. ? 'with indexes = CLIBINDX.NDX and CLIBINKW.NDX'
  168. Store d+':CLIBINDX' to NFILE
  169. Copy to &NFILE
  170. Use &NFILE
  171. Store d+':CLIBINKW' to OFILENDX
  172. Index on keywordndx to &OFILENDX
  173. Index on sourcecode to &NFILE
  174. Use
  175. ? 'New Library and index files are now created. '
  176. Accept 'Press <retn> to enter Book Publication/Reference codes' to XX
  177. Store 'CLIBRARY Book Reference / Publication code entry routine.' to INH
  178. Store D+':CLIBINDX' to MFILE
  179. Store D+':CLIBINKW' to MFILENDX
  180. Do REFCODES.CMD
  181. USE
  182. endif
  183. Release nfile,ofilendx
  184. Store '9' to XX
  185. endif
  186. If XX='2'
  187.       Select secondary
  188.       Use
  189.       Select primary
  190.       Store d+':CLIBRARY' to MFILE
  191.       Use &MFILE
  192.       ? 'Now re-indexing CLIBRARY file by SOURCECODE.'
  193.       Set talk on
  194.       Index on sourcecode to &MFILE
  195.       Set talk off
  196.       Store d+':CLIBINDX' to MFILE1
  197.       Use &MFILE1
  198.       ? 'Now re-indexing CLIBINDX file by SOURCECODE.'
  199.       Set talk on
  200.       Index on sourcecode to &MFILE1
  201.       Set talk off
  202.       Store d+':CLIBINKW' TO MFILE2
  203.       ? 'Now re-indexing CLIBINDX file by KEYWORDNDX.'
  204.       Set talk on
  205.       Index on keywordndx to &MFILE2
  206.       Set talk off
  207.       Accept 'Re-building is complete. Press <RETURN>' to XX
  208.       Release MFILE1,MFILE2
  209.       Use
  210. endif
  211. If XX='3'
  212.   @ 16,0
  213.   @ 17,0
  214.   @ 18,0
  215.   @ 19,0
  216.   @ 20,0
  217.   @ 21,0
  218.   @ 22,0
  219.   @ 15,0
  220.   ? '            Names Directory editing'
  221.   Store D to DD
  222.   @ 18,9 say 'Data disk drive ' get DD
  223.   ?
  224.   READ
  225.   ? 'Now saving the new Data Disk Drive designator.'
  226.   Select secondary
  227.   Use UDIRFILE
  228.   GOTO 2
  229.   Replace spact with $(spact,1,20)+!(DD)
  230.   Store DD to D
  231.   Use
  232.   Select primary
  233. endif
  234.     CASE !(MSEL) = 'Q'
  235.       Select secondary
  236.       USE
  237.       Select primary
  238.       USE
  239.       Store F to LEVEL1
  240.   ENDCASE
  241. ENDDO
  242. Store T to LEVEL1
  243. RETURN
  244. 
  245.   @ 7,9 say  ' 1)  Enter new Book Articles                          /REFERNTR/'
  246.   @ 8,9 say  ' 2)  Recall Books by a selected SUBJECT               /REFSELCT/'
  247.   @ 9,9 SAY  ' 3)  Books Library REPORTS                            /REFREPTS/'
  248.   @ 10,