IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Remote Return Codes from REXEC calling from REXX


IBM Mainframe Forums -> CLIST & REXX
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
kanne

New User


Joined: 16 Dec 2009
Posts: 4
Location: Wiesbaden, Germany

PostPosted: Fri Jan 29, 2010 5:12 pm
Reply with quote

Hi guys,

this is my first post as I'm rather new to Mainframe activities. I read a lot here already that helped me understand different aspects of OS/390 related topics.

But now to my problem:

I do some REXECs from MVS to UNIX using REXX.

My code looks like this:

Code:

sendrexec:                         
   x=outtrap('rexec1output.');     
   "REXEC -d" server rexeccommand1 
   x=outtrap('off');               
   rexec1rc=rc;                 


As a matter of fact, I do get local returncodes by calling from rc.

I now had the idea to put the remote rc on the remote-side into a file and later on get this file to check it on the MVS side.

I just would like to know, if there is some easier way of getting the result. I looked up the Internet and some related IBM documentation but didn't find anything useful, whereas I did find info on howto do it for FTP. Do you have an idea, how I could catch remote return codes by calling REXEC this way?

Thanx for any suggestions in advance.

Cheers!
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Fri Jan 29, 2010 5:51 pm
Reply with quote

You should have ... if You had searched with rexec command return code

here is a suggestion I found...

On the remote host echo the exit code after the command has completed and use that on the localhost by using tail -1 on the output of the rexec command.

used with something like ...
"REXEC -d" server rexeccommand1; echo $0

watch for the quotes and apostrophes !

not tested!!
Back to top
View user's profile Send private message
PeterHolland

Global Moderator


Joined: 27 Oct 2009
Posts: 2481
Location: Netherlands, Amstelveen

PostPosted: Fri Jan 29, 2010 6:22 pm
Reply with quote

Mainframe UNIX or external UNIX boxes?
Back to top
View user's profile Send private message
kanne

New User


Joined: 16 Dec 2009
Posts: 4
Location: Wiesbaden, Germany

PostPosted: Fri Jan 29, 2010 6:29 pm
Reply with quote

@enrico:
Thanx a lot so far, I found the link you refer to.
Actually I use an echo $? to get rc and would you it for my imho little overkill idea to write rc to a file remote and ftp it back to process it further. Tough that should work somehow.
By using echo $? and not putting it into a file, that is, just displaying it, I find it in my Rexx output but don't know how to parse it. I know of tail -1 but can't figure how to use such a construct in Rexx. Any hints are highly appreciated. Btw, in production my whole Rexx will be called by another Rexx, which again is started by JCL if that matters at all.

@Peter:
Thanx too for participating on this. I'm communicating with an external Unix box.

Cheers!
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Fri Jan 29, 2010 6:39 pm
Reply with quote

what happens when You issue a rexec from the tso command line..
IIRC if You get an output You should see on the screen,
if it is so then outtrap should ... the namell trap it
an since You can outtrap to a stem , all You need is to do a bit of tweaking on the stem itself
Back to top
View user's profile Send private message
kanne

New User


Joined: 16 Dec 2009
Posts: 4
Location: Wiesbaden, Germany

PostPosted: Fri Jan 29, 2010 6:57 pm
Reply with quote

Hi,

your idea sound perfect.
As a matter of fact, the OUTTRAP is not trapping anything. My stem is empty. I think it is because the stuff displayed there is not coming from REXX say commands. Apperently remote output is not getting trapped. Is there another way of getting this done?
Many thanx for your input so far!

Cheers!
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> CLIST & REXX

 


Similar Topics
Topic Forum Replies
No new posts Compile Several JCL JOB Through one r... CLIST & REXX 4
No new posts Running REXX through JOB CLIST & REXX 13
No new posts Error to read log with rexx CLIST & REXX 11
No new posts isfline didnt work in rexx at z/OS ve... CLIST & REXX 7
No new posts run rexx code with jcl CLIST & REXX 15
Search our Forums:

Back to Top