Bpxwunix uses STDOUT and STDERR for the output and error processing.  So, add 
them to your CALL statement

call bpxwunix cmd,,,stdout.,stderr.

say "stdout output : "
do i=1 to stdout.0
  say stdout.i
end

say "stderr output : "
do i=1 to stderr.0
   say stderr.i
end

Thanks,
Kolusu

-----Original Message-----
From: IBM Mainframe Discussion List <[email protected]> On Behalf Of 
[email protected]
Sent: Sunday, August 3, 2025 8:22 AM
To: [email protected]
Subject: [EXTERNAL] Obtaining the Return Code from bpxwunix in a REXX progrm,

Hello -.Im not well versed in Rex -.I'm executing a Rexx program in z/os from 
tso Option 6I can issue a call to call bpxwunix 'ls -l',,out..I do get some 
unpredictable results, and most of the time I get the desired results-In 
other-words the results of the call to bpxwunix for ls -la is not consistent .I 
have modified the code to obtain the Return code from the call to bpxunit 
-..Here is the current source:ADDRESS syscall- "chdir " cmdstrg call bpxwunix 
'Su'
RC = $?
Say 'RC From bpxunix .......'  $?
Say 'RC From bpxunix .......'  RC
call bpxwunix 'ls -l',,out.
RC = $?
Say 'RC From bpxunix .......'  $?
Say 'RC From bpxunix .......'  RC ..The issue is the Say command always results 
the value of $? not the specific return code -.How do I get the return code 
from bpxunix call and display it properly in a Rexx program505165 -Thank 
YouPaul D'Angelo.

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions, send email to 
[email protected]<mailto:[email protected]> with the message: 
INFO IBM-MAIN


----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN

Reply via email to