Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Remote Return Codes from REXEC calling from REXX

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CLIST & REXX
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    Post subject: Remote Return Codes from REXEC calling from REXX
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

Global Moderator


Joined: 14 Mar 2007
Posts: 10210
Location: italy

PostPosted: Fri Jan 29, 2010 5:51 pm    Post subject: Reply to: Remote Return Codes from REXEC calling from REXX
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: 2422
Location: Netherlands, Amstelveen

PostPosted: Fri Jan 29, 2010 6:22 pm    Post subject:
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    Post subject: Reply to: Remote Return Codes from REXEC calling from REXX
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

Global Moderator


Joined: 14 Mar 2007
Posts: 10210
Location: italy

PostPosted: Fri Jan 29, 2010 6:39 pm    Post subject: Reply to: Remote Return Codes from REXEC calling from REXX
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    Post subject: Reply to: Remote Return Codes from REXEC calling from REXX
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    IBMMAINFRAMES.com Support Forums -> CLIST & REXX All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts How to Capture the Max return code of... anilkumar922 All Other Mainframe Topics 0 Thu Jan 12, 2017 12:02 pm
This topic is locked: you cannot edit posts or make replies. Calling REXX code from ISPF panel sanchita dey TSO/ISPF 4 Mon Jan 02, 2017 5:13 pm
No new posts REXX DB2: Dynamic allocation of DB2.D... BHAS CLIST & REXX 3 Mon Dec 19, 2016 8:26 pm
No new posts find particular member name in PDS us... ravi243 CLIST & REXX 10 Mon Dec 19, 2016 6:44 pm
No new posts What is the command to check MODE of ... rohanthengal CLIST & REXX 7 Fri Nov 18, 2016 1:48 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us