On 5/14/2016 12:33 PM, Kris Buelens wrote:
> There are other tricks: make 1 record of both the counter and the
> data.

Problem with that is that then you actually have to process the counter
with every record.  A dirtier trick that comes to mind is to put the
counter on another stream and dig it out with JUXTAPOSE when you want it:

  /* untested */

  'addstream both num'

  'addpipe (end /) *:'     , /* read primary input */
    '| in: chop 0'         , /* send record below */
    '| specs number 1'     , /* build record number */
    '| num: juxtapose      , /* add on input below */
    '| *.in.num:'          , /* short to alt input */
    '/ *.out.num:'         ,  /* read alt output */
    '| num:'               ,  /* add to number above */
    '/ in:'                , /* input above */
    '| *.in:'              , /* short to primary input */

  ...

  'callpipe (end /) literal | *.out.num: / *.in.num: | var where'

Note that the number is reliable only if you've done a PEEKTO to read
but not release the input record.  Once you release it, you don't know
if the next record number's been written or not.

¬R

Reply via email to