Here's one I never noticed before.  Often I'll do something like:

> Do i = 0 Until filelist | (rc ¬= 0)
>
>   'PIPE rexxvars' i 'nomsg233'                 ,
>     '| take 1'                                 ,
>     '| strfind ,s_CMS_COMMAND_FILELIST_EXEC_,' ,
>     '| count lines'                            ,
>     '| var filelist'                           ,
>
> End

I just had a case where I want to know if the current exec has called
itself, so I want to skip level 0.  I changed i=0 to i=1 in my loop, and
ran into Error 34: Logical value not 0 or 1.  Even though the message is
suppressed, REXXVARS (as documented) only commits to -1, the rest of the
pipeline doesn't run, and my variable never gets set.

The obvious workaround in this case is just to set my variable to 0
before starting the loop.  If I needed to do more in the pipeline,
though, I'd have to wrap REXXVARS in something to mask the failure.
PREFACE seems to do the trick, by moving it into a called pipeline:

> pipe preface rexxvars 1 nomsg233|count lines|cons

> 0

> Ready(00233);


Actually, though, looking at the PREFACE doc, I wasn't so sure that was
actually safe:

> Commit Level:  "preface" starts on commit level -1.  The subroutine  pipeline
> must commit to 0 if it generates output.                                     

And in fact, if I leave off NOMSG233, it doesn't commit:

> pipe preface rexxvars 1|count lines|cons                                      
>   
> No active EXECCOMM environment found.                                         
>   
> ... Processing "callpipe (name Append/Preface stagesep | escape "".           
>   
> ... Issued from stage 1 of pipeline 1 name "Append/Preface".                  
>   
> ... Running "rexxvars 1".                                                     
>   
> Ready(00233);                                                                 
>   

So I guess the simple, safe solution is actually APPEND, which obviously
has to commit before it can see EOF on the input:

>   'PIPE append rexxvars' i 'nomsg233'
etc.

But what's going on with PREFACE?  Does it detect whether the subroutine
pipeline issued any messages, and commit if not?

¬R

Reply via email to