I knew I had written some "sipping stages" in the past where I didn't
need PEEKTO to put any input in REXX variables, and I only needed
STREAMSTATE SUMMARY to check whether to continue:
'streamstate summary'
Do While rc = 0
'callpipe *: | take' etc.
If rc = 0 Then 'streamstate summary'
End
I just wrote another one and found it reliably went one round too far,
not detecting EOF until after it had issued another CALLPIPE *:|TAKE
etc. Turns out all the older stages I have like this carefully avoid
this pitfall in other ways. Either the called pipeline won't produce
any output without input, or it uses something like TOTARGET to find the
start of the next group of records so that it will always read to EOF on
the last group. I guess I should have started putting in comments at
some point explaining why PEEKTO is *not* needed!
So beware--don't let a STREAMSTATE SUMMARY lead you to run too far.
'streamstate summary'
If rc = 0 Then 'peekto'
Do While rc = 0
'callpipe *: | take' etc.
If rc = 0 Then 'streamstate summary'
If rc = 0 Then 'peekto'
End
¬R