The problem is that the added PIPE runs independently of the REXX stage
that added it. That REXX stage may have ended long before the added pipe
ends (or even before it really starts). That's the reason why VAR and
Friend in an added PIPE don't even try to set variables in the REXX that
added it, but a level lower.
To pass "things" to the REXX that added the pipe section, other techniques
must be used, like an extra input stream. A simple solution for this case:
use a CALLPIPE to grab the variable that was set a level lower:
'PEEKTO record'
if rc=0 then 'CALLPIPE VAR Where 1!Var Where'
Kris Buelens,
--- freelance z/VM consultant, Belgium ---
-----------------------------------------------------------------------
2016-05-14 17:07 GMT+02:00 <[email protected]>:
> Building a parser for nibble-oriented files I tried to get an
> indicator 'where I am'. So I coded in my REXX
>
> > "ADDPIPE (sep ! end ?) *.input:",
> > '! spec *-* c2x 1',
> > '! fblock 2',
> > '! reverse',
> > '! fblock 1',
> > '!a:sync',
> > '!*.input:',
> > '? literal',
> > '! dup *',
> > '!a:',
> > '! spec recno',
> > '! var where tracking'
>
> so regardless if I read single nibbles with READTO or several in a
> row with CALLPIPE *: | take (several) the variable 'where' could
> tell where I am.
>
> Alas it seems I am not able to set a variable by ADDPIPE in the
> REXX containing this ADDPIPE. If I call it from CMS commandline
> there is "No active EXECCOMM", if I call it from an EXEC then
> using variable 'where' triggers NOVALUE. And the keyword PRODUCER
> may not be used when var is involved via ADDPIPE. (I even tried to
> 'forward' the used variable pool and get the bemusing information
> "Number -1 cannot be negative.")
>
> How may I get a "central record counter" in a REXX?
>
> Ciao.....Mike
> --
> www.Ok.de - die kostenlose E-Mail Adresse
>