In addition to the fact that you're using RC instead of RESULT, you're changing 
RC before you display it. After RC=$?, RC and $? will have the same value.

It's a good practice to use a string literal or a variable when passing a stem 
name; if you ever set a default value (out.=foo) then out. will no longer have 
the value. 'OUT.'.

-- 
Shmuel (Seymour J.) Metz
http://mason.gmu.edu/~smetz3
עַם יִשְׂרָאֵל חַי
נֵ֣צַח יִשְׂרָאֵ֔ל לֹ֥א יְשַׁקֵּ֖ר




________________________________________
From: IBM Mainframe Discussion List <[email protected]> on behalf of 
[email protected] <[email protected]>
Sent: Sunday, August 3, 2025 11:21 AM
To: [email protected] <[email protected]>
Subject: Obtaining the Return Code from bpxwunix in a REXX progrm,


External Message: Use Caution


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] 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