What makes you think you are losing a record?  Absent premature termination, 
the input stream cannot be severed until the last record has been consumed by 
the stage(s) that follows predselect.  

If you just want to grab the last record, what about "take last 1"?

I think we need to hear more.

-----Original Message-----
From: CMSTSO Pipelines Discussion List [mailto:[email protected]] On 
Behalf Of Glenn Knickerbocker
Sent: Wednesday, May 20, 2009 4:57 PM
To: [email protected]
Subject: [CMS-PIPELINES] selecting the last line of a file with PREDSELECT

I just stumbled on this quirk of PREDSELECT and wondered how many last
lines I've lost in the past:

  "It terminates as soon as its primary input stream is severed."

I'm guessing (hoping) I haven't actually run into this before, but in
this case I was specifically trying to grab the last record by using
STRLITERAL APPEND to tack a record onto the alternate input.  It may be
just dumb luck that I even saw the problem right away, because
STRLITERAL's input was actually severed first, so if STRLITERAL had
happened to run before PREDSELECT's primary was severed I might never
have known anything was wrong.

The workaround I came up with is to copy the same extra record to the
end of the alternate input and *then* to the primary:

  (end /) ...  | sticky: fanin | out: predselect | ...
       / ... | last: fanin | out:
       / literal | extra: fanout | last:
       / extra: | sticky:

This way, the primary is still connected when the extra record arrives
on the alternate.  If the alternate output is used, it's important to
make sure a record won't arrive late on input 2 and select the extra
record for the alternate.

¬R

Reply via email to