Hi,

Well, of course, as soon as I posted I then spotted that I had not corrected 
quoted the stderr. stem varname.

Actually, the sample code did not come from IBM but from:-

https://www.ibm.com/developerworks/community/blogs/MartinPacker/entry/bpxwunix_z_os_best_kept_secret10?lang=en

A very good blog update from Mr Packer.

The code below does work. My tests prior to quoting the stem variables did fail.

Tracing did show they were being set to blanks.  It took a little while longer 
to interpret and understand the trace. 

IBM examples are do not quote the stem variables, and are relying on the 
default STEM variable behaviour:-

To trap output from the ls command and display it:
 call bpxwunix ’ls -l’,,out.
    do i=1 to out.0
       say out.i
    end
To send output from the previous example to word count and print the byte count:
 call bpxwunix ’wc’,out.,bc.
     parse var bc.1 . . count
     say ’byte count is’ count

To trap output on stack and feed it to word count:
 if bpxwunix(’ls -l’,,stack)=0 then
       call bpxwunix ’wc’,stack

ref: Using REXX and z/OS UNIX System Services  SA23-2283-30

The post was to put in archives to remind that using quoted stem vars are 
better when calling bpxwunix.


On Wed, 13 Jun 2018 01:53:36 -0500, Bruce Hewson <bruce_hew...@hotmail.com> 
wrote:

>I thought I would try out using "bpxwunix" in REXX.
>
>The sample code worked fine.
>
>But, I normally code with SIGNAL NOVALUE active.
>
>Then the sample did not work.  It took me a little while to work out. 
>
>This does work:-
>
>/*REXX****************************************************************/    
> Trace 'o'                                                                 
> Signal on Syntax                 /* for unexpected results.         */    
>/*===================================================================*/    
>  unsorted_data. =                                                         
>  unsorted_data.0=5                                                        
>  unsorted_data.1="KIJJ"                                                   
>  unsorted_data.2="KQWR"                                                   
>  unsorted_data.3="ADGF"                                                   
>  unsorted_data.4="OEPE"                                                   
>  unsorted_data.5="VNVV"                                                   
>                                                                           
>  sorted_data. =                                                           
>  sorted_data.0=0                                                          
>                                                                           
>  cmd="sort"                                                               
>                                                                           
>  call bpxwunix cmd,"unsorted_data.","sorted_data.",stderr.                
>                                                                           
>  say "sorted_data:"                                                       
>  say "======="                                                            
>  do i=1 to sorted_data.0                                                  
>    say sorted_data.i                                                      
>  end                                                                      
>                                                                           
>  say "stderr:"                                                            
>  say "======="                                                            
>  do i=1 to stderr.0                                                       
>     say stderr.i                                                          
>  end                                                                      
>Return                                                                     
>/*===================================================================*/    
>
>I have not listed the diagnostic section for the SIGNAL processes.
>
>Note the quoted stem names.  This is required.
>


Regards
Bruce Hewson

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN

Reply via email to