On Sat, Jul 10, 2010 at 4:39 AM, Bob Cronin <[email protected]> wrote:

> A BSMTP mail file can contain multiple emails separated by lines that
> consist of a single dot. I need to extract the individual emails into their
> own files. I wrote a pure Rexx filter to do it which works, but is
> excruciatingly slow for large inputs as it goes line by line through the
> input deciding whether to start a new output file or not and then append the
> line to the appropriate file (you know, peekto, look at the input line,
> check for the single dot, append it to the current file if not, else start a
> new file and write it there, readto, rinse, repeat. It concocts output
> filenames on-the-fly and writes them to the primary output (which I then
> dump into a stem for subsequent processing).

It depends on what you do with it afterwards. I assume you currently
have a pipeline that expects to get a single object handed in a number
of records. In that case, a sipping pipeline would do:

do forever
  'peekto'
  'callpipe *: | totarget pick 1-* == /./ | whateveryouneed
  'readto'  /* the separator */
end

This will ony go through the REXX loop once for every object, not for
every record. Might be one or two orders of magnitude difference,
depending on what the real process is.

Reply via email to