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

  1. * Program CTAPELIB - Manages tape label records
  2. Clear
  3. Set intensity off
  4. Set talk off
  5. Set deleted on
  6. Store 'January  February March    April    May      June     ' to MONTHS
  7. Store MONTHS+'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.   Store VAL(curmonthx) to CURYEAR
  20.   If $(date(),4,1) = '0'
  21.     Store $(DATE(),5,1) to CURMONTHX
  22.   else
  23.     Store $(DATE(),4,2) to CURMONTHX
  24.   endif
  25.   Store trim($(months,NMONTH*9-8,9)) to curmonth
  26.   Store curmonth+' '+curmonthx to curmonthx
  27.   Store ', 19'+$(DATE(),7,2) to CURYEAR
  28.   Store curmonthx+curyear to curdate
  29. Select primary
  30. Use UDIRFILE
  31. release curmo,months,curyear,curmonthx
  32. GOTO 2
  33. Store !($(spact,21,1)) to D
  34. GOTO 5
  35. Store val($(spact,28,2)) to labellpp
  36. SKIP
  37. Store val($(spact,28,2)) to labelspa
  38. SKIP
  39. Store val($(spact,28,2)) to labl1col
  40. Store d+':TLABELS.NDX' to MFILENDX
  41. Set talk off
  42. Store T to continue
  43. Do while continue
  44.   USE
  45.   Select primary
  46.   Use
  47.   Store D+':TLABELS' to MFILE
  48.   ERASE
  49.   @ 1,1 say 'DATA DISK = '+D
  50.   @ 1,60 say curdate
  51.   @ 2,20 say 'TAPE LABELS Program'
  52.   @ 5,9 say  '1.  Enter new labels'
  53.   @ 6,9 say  '2.  Print labels    '
  54.   @ 7,9 say  '3.  Edit an existing label'
  55.   @ 8,9 say  '4.  Print all existing labels by date, on the printer'
  56.   @ 9,9 say  '5.  Create a new, empty TLABELS file'
  57.   @ 10,9 say '6.  Names Directory Editing'
  58.   ?
  59.   Accept '         Enter selection ' to ESEL
  60.   ?
  61.   If !(ESEL)='DISK='
  62.     If len(ESEL)>5
  63.       Store !($(ESEL,6,1)) to D
  64.       ? 'Now changing the data disk to drive',D
  65.       Store D+':TLABELS' to MFILE
  66.     endif
  67.     Store D to ESEL
  68.   endif
  69.   Do while @(ESEL,'123456QqD')=0
  70.    Accept 'Invalid entry. Please enter again ' to ESEL
  71.   enddo
  72.   If ESEL<>'6'.and.!(ESEL)<>'Q'
  73.     If file(MFILE)
  74.       Use &MFILE index &MFILE
  75.     else
  76.       ? 'File',MFILE,'not found on the data disk. Perform SET UP to create it.'
  77.       ?
  78.     endif
  79.   endif
  80.   Do case
  81.     Case ESEL = '1'
  82. Store 'Y' to level2
  83. Do while !(LEVEL2)<>'N' .and. !(LEVEL2)<>'Q'
  84. ERASE
  85. Store '                                        ' to xtitle,xtitle2,xtext
  86. Store '                      ' to xspeaker
  87. Store '          ' to XDATE
  88. @ 2,20 say  'Tape Labels - New entry'
  89. @ 5,3 say 'TITLE    ' get xtitle
  90. @ 6,12 get XTITLE2
  91. @ 7,3 say  'TEXT     ' get xtext
  92. @ 8,3 say  'SPEAKER  ' get XSPEAKER
  93. @ 9,3 say  'DATE     ' get xdate
  94. @ 9,43 say 'SERIES  ' get series
  95. @ 11,20 say 'Press ctrl-W when finished.'
  96. READ
  97. If xtitle<>'                    '
  98.   Append blank
  99.   Replace title with xtitle
  100.   Replace title2 with xtitle2
  101.   Replace text with xtext
  102.   Replace speaker with xspeaker
  103.   Replace date with xdate
  104.   Replace DATESORT with $(DATE,7,2)+$(date,1,2)+$(DATE,4,2)+$(date,10,1)
  105. else
  106.   ? 'TITLE is blank. No entry is made.'
  107. endif
  108. Accept 'Another? ' to LEVEL2
  109. enddo
  110. Use &MFILE index &MFILE
  111.     Case ESEL = '2'
  112. Store 'Y' to LEVEL2
  113. Do while !(LEVEL2)<>'Q' .and. !(LEVEL2)<>' ' .and. !(level2)<>'N'
  114. Store T to invalid1
  115. Do while invalid1
  116.  ? 'Enter the date designator of the label you desire.'
  117.  ? 'Date designator format: MM/DD/YY,T (month/day/year,time)'
  118.  Accept '                       ' to  indate
  119.  If !(indate)='Q' .or. ' '=indate
  120.   Store 'Q' to level2
  121.   Store  F to invalid1
  122.  else
  123.   If $(indate,2,1) = '-' .or. $(indate,2,1) = '/'
  124.    Store ' '+indate to indate
  125.   endif
  126.   Store len(trim(indate)) to lenind
  127.   If lenind<10
  128.    Accept 'Date designator is too short. Enter again' to indate
  129.   else
  130.   Store $(indate,7,2)+$(indate,1,2)+$(indate,4,2)+$(indate,10,1) to indatex
  131.   Find &indatex
  132.   If # = 0
  133.     ? 'No label record found with this date:',indate
  134.   else
  135.     Store F to invalid1
  136.   endif
  137.   endif
  138. ENDDO
  139. If !(level2)<>'Q'
  140.  Accept 'Enter the number of label copies wanted' to tln
  141.  Store val(tln) to tlnumb
  142.  Store 0 to lnumb
  143.  Store labellpp-2 to lbpage
  144.  Do while tlnumb > 0
  145.   Set format to print
  146.   Store lnumb to linenum
  147.   Store tlnumb-1 to tlnumb
  148.   Store len(trim(title)) to titlelen
  149.   Store (32-titlelen)/2 to inset
  150.   @ linenum,labl1col+inset say title
  151.   Store len(trim(title2)) to titlelen
  152.   If titlelen <> 1
  153.     Store (32-titlelen)/2 to inset
  154.     @ linenum+1,labl1col+inset say title2
  155.     Store linenum+1 to linenum
  156.   endif
  157.   @ linenum+1,labl1col say text
  158.   @ linenum+2,labl1col say speaker
  159.   @ linenum+2,labl1col+24 say date
  160.   Store lnumb+labelspa to lnumb
  161.   If lnumb>lbpage
  162.     EJECT
  163.     Store 0 to lnumb
  164.   endif
  165.  enddo
  166.  If lnumb<=lbpage
  167.  EJECT
  168.  endif
  169.  Set format to screen
  170.  ?
  171.   ACCEPT 'Another? ' to level2
  172.  endif
  173. endif
  174. ENDDO
  175.     CASE ESEL = '3'
  176. Store 'Y' to invalid9
  177. Do while !(invalid9)<>'N'.and.invalid9<>' '.and.!(invalid9)<>'Q'
  178. Store T to invalid1
  179. ? 'Enter date to the desired tape'
  180.      ? 'Date format is: MM/DD/YY,T'
  181. Accept '               ' to inlabl
  182. Do while invalid1
  183.  If !(inlabl) = 'Q'
  184.     Store 'Q' to invalid9
  185.     Store F to invalid1
  186.  else
  187.   If $(inlabl,2,1) = '-' .or. $(inlabl,2,1) = '/'
  188.     Store ' '+inlabl to inlabl
  189.   endif
  190.   Store len(inlabl) to lenlabl
  191.   If lenlabl<10
  192.     Accept 'Invalid date designator [MM/DD/YY,T]. Please re-enter ' to inlabl
  193.   else
  194.     Store $(inlabl,7,2)+$(inlabl,1,2)+$(inlabl,4,2)+$(inlabl,10,1) to inlablx
  195.     Find &inlablx
  196.     If # = 0
  197.       Accept 'Record not found. Enter again: ' to inlabl
  198.     else
  199.       Store F to invalid1
  200.     endif
  201.   endif
  202.  endif
  203. enddo
  204. If !(invalid9)<>'Q'
  205. Store F to GOODREC
  206. Do while .not. GOODREC
  207.   ERASE
  208.   @ 2,20 say 'Tape Labels - Modifying an old entry'
  209.   @ 5,8  say 'TITLE    ' get title
  210.   @ 6,17 get title2
  211.   @ 7,8  say 'TEXT     ' get text
  212.   @ 8,8 say  'SPEAKER  ' get speaker
  213.   @ 9,8 say  'DATE     ' get date
  214.   @ 9,40 say 'SERIES '   get series
  215.   @ 11,20 say 'Press ctrl-W when finished'
  216.   READ
  217.   Store T to goodrec
  218.   @ 12,0 say '                                                                '
  219.   If len(trim(date))>8
  220.     If len(trim(date))=9 .and. ($(date,2,1)='/'.or.$(date,2,1)='-')
  221.       Replace DATE with  ' '+date
  222.     endif
  223.   else
  224.     ? 'The date field must have at least 9 characters. Please re-enter.'
  225.     Store F to goodrec
  226.   endif
  227.   Replace datesort with $(date,7,2)+$(date,1,2)+$(date,4,2)+$(date,10,1)
  228. enddo
  229. endif
  230. Accept 'Another? ' to invalid9
  231. enddo
  232. USE &MFILE index &MFILE
  233.     Case ESEL = '4'
  234. ?
  235. Accept 'Enter a starting label date, or press <retn> for all' to inlabl
  236. If inlabl = ' '
  237.   GOTO top
  238. else
  239.   Store T to invalid2
  240.   Do while invalid2
  241.     If $(inlabl,2,1) = '-' .or. $(inlabl,2,1) = '/'
  242.       Store ' '+inlabl to inlabl
  243.     endif
  244.     If len(inlabl) < 10
  245.       Accept 'Invalid label designator. Please re-enter: ' to inlabl
  246.     else
  247.      Store $(inlabl,7,2)+$(inlabl,1,2)+$(inlabl,4,2)+$(inlabl,10,1) to inlablx
  248.      Find &inlablx
  249.      If # = 0
  250.       Accept 'Label designator not found. Please re-enter: ' to inlabl
  251.      else
  252.       Store F to invalid2
  253.      endif
  254.     endif
  255.   enddo
  256. endif
  257. Store 1 to pgnumb
  258. Store 99 to linenumb
  259. Set format to print
  260. Do while .not. EOF
  261.   If linenumb > labellpp
  262.     If linenumb<>99
  263.     EJECT
  264.     endif
  265.     Store STR(PGNUMB,4) to pgnumbr
  266.     @ 2,2 say 'Tape Labels - '+curdate+'   Page'+pgnumbr
  267.     Store 5 to linenumb
  268.   endif
  269.   If title2='                              '
  270.     @ linenumb+1,4 say title
  271.   else
  272.     @ linenumb,4 say title
  273.     @ linenumb+1,4 say title2
  274.   endif
  275.   @ linenumb+2,4 say text
  276.   @ linenumb+3,4 say speaker
  277.   @ linenumb+4,4 say date
  278.   @ linenumb+4,30 say series
  279.   Store linenumb+6 to linenumb
  280.   SKIP
  281. ENDDO
  282. EJECT
  283. Set format to screen
  284. Accept 'Report is complete. Press <RETURN> ' to XX
  285.     Case ESEL='5'
  286. Accept ;
  287. 'This process clears any existing TLABELS file and makes a new one. OK?' to XX
  288.      If !(XX)='Y'
  289.        Store 'TLABELX.DBF' to MFILEX
  290.        If file(MFILEX)
  291.          use &MFILEX
  292.          Copy to &MFILE
  293.          USE &MFILE
  294.          Index on datesort to &MFILE
  295.          Accept 'New TLABELS file is now created. Press <RETN> ' to XX
  296.        else
  297.      Accept 'File TLABELX not found on the program disk. Press <RETURN>' to XX
  298.        endif
  299.      endif
  300.      Store d+':TLABELS' to MFILE
  301.      USE &MFILE index &MFILE
  302.     Case !(ESEL)='6'
  303.       Use UDIRFILE
  304.       ?
  305.       ? '  Editing CTAPELIB Names Directory parameters'
  306. Use udirfile
  307. GOTO 2
  308. Store $(SPACT,21,1) to MD2
  309. GOTO 5
  310. Store $(spact,28,2) to MD4
  311. SKIP
  312. STORE $(SPACT,28,2) TO MD5
  313. SKIP
  314. Store $(spact,28,2) to MD6
  315.   @ 18,0 say 'Disk I.D. containing data files ' get MD2
  316.   @ 19,0 SAY 'Tape Labels, LINES PER PAGE ' GET MD4
  317.   @ 20,0 SAY 'Tape Labels, labels  spacing' GET MD5
  318.   @ 21,0 SAY 'Tape Labels, 1st column     ' GET MD6
  319.   READ
  320.   ?
  321.   Accept '    SAVE? ' to MDX
  322.   If !(MDX)='Y'
  323.     GOTO 2
  324.     Replace spact with $(SPACT,1,20)+MD2
  325.     Store !(MD2) to D
  326.     GOTO 5
  327.     Replace spact with $(spact,1,27)+MD4
  328.     Store val(MD4) to labellp
  329.     SKIP
  330.     Replace spact with $(spact,1,27)+MD5
  331.     Store val(MD5) to labelspa
  332.     SKIP
  333.     Replace spact with $(spact,1,27)+MD6
  334.     Store val(MD6) to labl1col
  335.     SKIP
  336.   endif
  337.     Case !(ESEL) = 'Q'
  338.       Store F to continue
  339.     endcase
  340.   enddo
  341. USE
  342. Store T to validd1
  343. RETURN
  344. = 'Q'
  345.       Store F to continue
  346.     endcase
  347.   enddo
  348. USE
  349. Store T to validd1
  350. RETURN
  351. ,17 get title2
  352.   @ 7,8  say 'TEXT     ' get text
  353.   @ 8,8 say  'SPEAKER  ' get speaker
  354.   @ 9,8 say  'DATE     ' get date
  355.   @ 9,40 say 'SERIES '   get series
  356.   @ 11,20 say 'Press ctrl-W when finished'
  357.   READ
  358.   Stor