On 6/19/2013 12:36 PM, Paul Gilmartin wrote:
>     callpipe *.input: | take N | *.output:
> 
> but does that discard the remainder of the input stream?
> Does it depend on whether a secondary output stream is
> connected?  Ah!  The Reference makes clear where the
> Author's Edition doesn't.  They're discarded.

No, the rest of the file is left in the pipeline, waiting to be read,
exactly as you want.  It won't be discarded until the entire pipeline
set terminates.

This is not *quite* equivalent:

>     do I = 1 to N
>         readto X
>         output X
>         end I

READTO releases the input record, which might allow a record on another
stream to race ahead of it.  That's what's meant by "delay the record."
 To prevent delay, read the record with PEEKTO instead, and then release
it with READTO *after* writing the output:

    do I = 1 to N
        peekto X
        output X
        readto
        end I

¬R

Reply via email to