> Is there a more elegant way to do the following PIPE structure:

> 'PIPE (ENDCHAR ?)',
> ... /* some stream of records */
> '| p: PICK ...
> '| t: TAKE ...
> 
> ...  /* only the records that pass all the filters come here */
> '?',
> 't:',
> '| f: FANINANY',
> 
> ...  /* all the records that were filtered out come here */
> '?',
> 'p:',
> '| f:'
> 
> What irks me is needing the last 3 lines.  As more filters get added 
more
> of these trivial connections are required.

> I'd really like to be able to connect the secondary output streams from
> multiple stages in the same pipe (in this case PICK and TAKE) directly 
to
> the pipe that collects the rejected records (in this case the pipe with
> FANINANY).  If I read the PIPE syntax correctly there's no alternative,
> but I'm hoping I've overlooked some technique.

For longer pipes, I try to put sections close together, using an extra 
FANOUT (labeled STEP2 below).  The overhead is nearly zero: when FANOUT 
detects it has only one output-stream it SHORT's itself out (that is: its 
input and ouitput get directly connected, the Master Plumber told me). 
Applied to your sample:

  'PIPE (ENDCHAR ?)',
  ... /* some stream of records */
  '| p: PICK ...
  '| t: TAKE ...
   ...  /* only the records that pass all the filters come here */
  '|STEP2: Fanout',  /* pass everything down to STEP 2 */
  '?p:|f:',
  '?',
  't:',
  '| f: FANINANY',
  ,/* Ready to execute STEP 2 -----------------*/
  '?STEP2:',
  ....

Kris,
IBM Belgium, VM customer support

Reply via email to