On Mon, Jul 13, 2009 at 11:01 PM, Ian S.
Worthington<[email protected]> wrote:

> What I don't appear to be able to get right is the trivial bit: Files STARTLU
> and START000 need to be fanned together into a single file, but all my
> attempts to do so seem to end in label redefinition hell.  Anyone care to
> restore my sanity?

I think you're trying to write the same file "startlu" from 2
different streams, so that's probably not what you want. And merging
the matched records and unmatched records in a single stream does not
make sense because the lookup would not serve a purpose...   but in
general you could do something like this:

  ..
 | k: nlocate ..        /* divert key records */
 | i: faninany
 | buffer
 | x: lookup .. detail
 | y: faninany
 | > output file a
 \ k:                     /* prolly key records */
 | z: nlocate ..
 | i:                      /* but not these */
 \ z:                    /* really keys */
 | x:
 | insert , not found , after
 | y:

Depending on the order of the records (if the key is before each of
the details that match it), you might also enjoy feeding the keys in
the tertiary input and avoid the need for the buffer stage.

Another interesting approach could be to use 'autoadd'  (which will
reject the first one with that key, and match subsequent ones) and
then inspect those rejects for being proper masters. Does that make
sense ?

Rob

Reply via email to