home *** CD-ROM | disk | FTP | other *** search
/ Meeting Pearls 3 / Meeting_Pearls_III.iso / Pearls / text / FAQ / bonus / faq_report.rexx < prev    next >
OS/2 REXX Batch file  |  1995-08-26  |  2KB  |  66 lines

  1. /*  ARexx script
  2.     for :Pearls/text/FAQ on CD "Meeting Pearls III"
  3.     scanning and reporting
  4.     $VER: faq_report.rexx 0.2 (26.08.95) ©1995 Khamsonh Marcel Khounlivong
  5.     */
  6.  
  7. OPTIONS RESULTS
  8.  
  9. PARSE ARG faq
  10.  
  11. faq = Strip(faq)
  12.  
  13. IF (faq == "") THEN do
  14.     SAY "faq_report.rexx 0.1 ©1995 Khamsonh Marcel Khounlivong"
  15.     SAY "Usage: faq_report[.rexx] FAQ"
  16.     EXIT 0
  17.     END
  18.  
  19. arcname     = ""
  20. arcnames    = "Archive-Name: Archive-name:"
  21. date        = ""
  22. dates       = "Date:"
  23. log         = ""
  24. string      = ""
  25. months      = "Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec"
  26. days        = "Mon Tue Wed Thu Fri Sat Sun"
  27.  
  28. IF ~open(file,faq,r) THEN log = '' || faq "can't open"
  29. ELSE DO
  30.     CALL scan_word
  31.     CALL scan_word
  32.     CALL Close(file)
  33.  
  34.     /*  easy date format TO use an equalation */
  35.     IF (Find(days,Strip(Word(date,1),,',')) ~= 0) THEN
  36.         date = SubStr(date, WordIndex(date,2))
  37.  
  38.     day   = Right(Word(date,1),2,'0')
  39.     month = Right(Find(months,Word(date,2)),2,'0')
  40.     year  = Right(Word(date,3),2)
  41.  
  42.     IF (arcname ~= "" & date ~= "") THEN
  43.         SAY Left(arcname,60) year || month || day faq
  44.     ELSE SAY '' || faq "missing keywords (date or archive name)"
  45.     END
  46. EXIT
  47.  
  48. scan_word:
  49.     DO UNTIL (string ~= "")
  50.         string = ReadLn(file)
  51.         END
  52.     DO WHILE (string ~= "")
  53.         string = Translate(string,' ','09'x)
  54.         IF (arcname ~= "" & date ~= "") THEN LEAVE
  55.         first = Strip(Word(string,1))
  56.         SELECT
  57.             WHEN (Find(arcnames, first) ~= 0) THEN
  58.                 arcname = SubStr(string,WordIndex(string,2))
  59.             WHEN (Find(dates, first) ~= 0) THEN
  60.                 date = SubStr(string,WordIndex(string,2))
  61.             OTHERWISE ;
  62.             END
  63.         string = ReadLn(file)
  64.         END
  65.     RETURN
  66.