home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 2 BBS / 02-BBS.zip / dwnsrt64.zip / downsum.cmd < prev    next >
OS/2 REXX Batch file  |  1998-01-16  |  1KB  |  56 lines

  1. /* ───────────────────────────────────────────────────────────────────── */
  2. /* Extract SUMmary from DOWNsort's ALLFileList    -    by Rob Hamerling  */
  3. /* ───────────────────────────────────────────────────────────────────── */
  4.  
  5. parse arg all sum
  6.  
  7. if sum = '' | all = '' then
  8.   do
  9.     call beep 800, 200
  10.     say ''
  11.     say 'Syntax:  DOWNSUM  <ALLFileList> <summary>'
  12.     say ''
  13.     say '         <ALLFileList> - filespec of inputfile'
  14.     say '         <summary>     - filespec of outputfile'
  15.     say ''
  16.     exit 1
  17.   end
  18.  
  19. say "Extracting file area summary report from ALLFileList '"all"'"
  20. if stream(all, 'C', 'query exist') = '' then
  21.   do
  22.     say " ALLFileList '"all"' could not be found"
  23.     exit 1
  24.   end
  25. if stream(sum, 'C', 'query exist') <> '' then
  26.   '@erase' sum '>nul'
  27.  
  28. do while lines(all) > 0              /* copy header */
  29.   l = linein(all)
  30.   if substr(l, 1, 5) = '═════' | substr(l, 1, 5) = '=====' then
  31.     leave
  32.   rx = lineout(sum, l)
  33. end
  34.  
  35. do while lines(all) > 0              /* skip to summary */
  36.   l = linein(all)
  37.   if substr(l, 1, 1) = ' ' then
  38.     leave
  39. end
  40.  
  41. if lines(all) = 0 then               /* check if summary present */
  42.   do
  43.     say 'No summary found in' all
  44.     exit 99
  45.   end
  46.  
  47. do while lines(all) > 0              /* rest of file is summary */
  48.   l = linein(all)
  49.   rx = lineout(sum, l)
  50. end
  51.  
  52. rc = stream(all, 'C', 'close')
  53. rc = stream(sum, 'C', 'close')
  54.  
  55. exit
  56.