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
 

 

Displaying the value set by the EXIT instruction

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CLIST & REXX
View previous topic :: :: View next topic  
Author Message
Ricardo Viegas

New User


Joined: 18 Oct 2012
Posts: 33
Location: Brasil

PostPosted: Tue Dec 03, 2013 5:17 am    Post subject: Displaying the value set by the EXIT instruction
Reply with quote

If in a REXX exec the EXIT instruction have a value (e.g. "EXIT 22"), I am receiving following returns:
a) in batch (IKJEFT01), the value appears in the SYSOUT as the RC (if the value is between 0 and 4095, otherwise the RC is set to 12)
b) in ISPF-3.4, if we issue "EXEC" at the side of the REXX exec member, the ISPF short message says "Command failed". Pressing PF1, the long message says "Command 'EXEC' issued return code 22".
c) again in ISPF-3.4, if we issue the command "TSO EXEC filename(execname)" at the command line there is no indication of the value set in the EXIT.
d) in ISPF-6, if we issue the command "EXEC filename(execname)", or simply "execname" (if the library is concatenated), there is no indication of the value set in the EXIT.
e) in TSO (out of ISPF), repeating same commands as previous item, again, no indication of the value.

Is there any way (ISPF settings, TSO profile or something else) that we can change the behavior in "c", "d" and "e" above (and similar ones) in order that the value set at the EXIT instruction be displayed?
Thanks!
Back to top
View user's profile Send private message

expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8593
Location: Back in jolly old England

PostPosted: Tue Dec 03, 2013 12:33 pm    Post subject:
Reply with quote

Perhaps showing your code might help us determine the problem(s)
Back to top
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 1713
Location: UK

PostPosted: Tue Dec 03, 2013 2:46 pm    Post subject:
Reply with quote

I think you have to SAY the value before exit so something like this
Code:
exit_rc = 22
Say "exiting with rc = "exit_rc
Exit
Back to top
View user's profile Send private message
Ricardo Viegas

New User


Joined: 18 Oct 2012
Posts: 33
Location: Brasil

PostPosted: Tue Dec 03, 2013 6:24 pm    Post subject:
Reply with quote

I am testing some of the REXX features in order to prepare code for a short course in REXX. So, I come to the "bare bone" code bellow

Code:
/* REXX - RetCode */
Exit  22           


I appreciate the suggestion on using a "Say" but I believe it is not a very practical one.

After I made the initial posting I realized one point, related to the online execution, but I am not quite sure about it: When the execution is made through ISPF, it catches the value returned by the EXIT and present it, and when the execution is send directly to TSO it does not present it. I am starting to pursue this point, but if anyone has more suggestions it will be really appreciated.

Thanks!
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8593
Location: Back in jolly old England

PostPosted: Tue Dec 03, 2013 7:07 pm    Post subject:
Reply with quote

If you are invoking ISPF services you will need to look at ZISPFRC
Back to top
View user's profile Send private message
Ricardo Viegas

New User


Joined: 18 Oct 2012
Posts: 33
Location: Brasil

PostPosted: Tue Dec 03, 2013 7:24 pm    Post subject:
Reply with quote

Hi Expat!

As a matter of fact, I am not invoking ISPF services inside the REXX exec. Inside ISPF-3.4 panel I am just submiting the REXX exec issuing the "EXEC" command at the side of the member.
Besides that, apparently, when the EXEC command is issued through ISPF we have no problem at all - ISPF shows the value set at the EXIT instruction. The problem (again, apparently!) occurs when the EXEC command is sent directly to TSO.

Regards, Ricardo
Back to top
View user's profile Send private message
Pedro

Senior Member


Joined: 01 Sep 2006
Posts: 2019
Location: Silicon Valley

PostPosted: Tue Dec 03, 2013 10:28 pm    Post subject: Reply to: Displaying the value set by the EXIT instruction
Reply with quote

Quote:
The problem (again, apparently!) occurs when the EXEC command is sent directly to TSO.


I think your observations are right. When done by ISPF, it catches the return code and when done by TSO it does not. That is just the way it works; I doubt you can report it as a problem.

My suggestion is to use two levels of rexx programs. The first program invokes the target exec and reports the return code. The second program does whatever work you want to do.

re: your short course on rexx... I think the point you are bringing up is a very minor point. It might not even be worth mentioning considering all of the other things about rexx that you could be teaching about.
Back to top
View user's profile Send private message
Ricardo Viegas

New User


Joined: 18 Oct 2012
Posts: 33
Location: Brasil

PostPosted: Tue Dec 03, 2013 11:22 pm    Post subject:
Reply with quote

Hi Pedro!

I think I will follow your suggestion in spite it bringing an additional problem to the user: If there is a REXX exec that sometimes runs online and sometimes runs in batch, the user will need to have two versions and always remember to update both versions when needed. A somewhat awkward approach.

I feel unconfortable with the fact that a REXX exec send a return code with the EXIT instruction and TSO simply ignores it. But, if that is really the case, no way to complain about....

Thanks!
Regards, Ricardo
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10202
Location: italy

PostPosted: Tue Dec 03, 2013 11:33 pm    Post subject: Reply to: Displaying the value set by the EXIT instruction
Reply with quote

I already gave You a solution here
http://www.ibmmainframes.com/viewtopic.php?t=59948&highlight=rexx+wrapper
Back to top
View user's profile Send private message
Ricardo Viegas

New User


Joined: 18 Oct 2012
Posts: 33
Location: Brasil

PostPosted: Wed Dec 04, 2013 1:19 am    Post subject:
Reply with quote

Hi Enrico!

Thanks for remembering me about the “WRAPPER” solution, I will re-analyze it, but I think what I am asking here is not exactly what was asked over there.
There, we talked about a lot of REXX execs running in batch (IKJEFT01), and how to pass the RetCodes between them.

Here I am asking about how to obtain the value (let’s call it RC) issued by the “EXIT” instruction in the online TSO. Bottomline, the question is, I have this exec:

Code:
/* REXX - RetCode */               
a = 5; b = 10                     
If a < b Then Exit 22; Else Exit 0


and I will call it directly in the online TSO environment (no ISPF active).
Is there any way that TSO will show me the RC?

You see, people that will learn about REXX will be coding an exec once a while and if there is any way to do it the simple way the better. If REALLY there is not such an option (TSO presenting the EXIT value), no big deal, I will present Pedro’s suggestion and yours WRAPPER suggestion (if it could be applied to the present online case). But, the drawback is that they are more complex than a simple "EXIT nn".

The above question is valid, too, if we are in ISPF-6 and issue the “EXEC ….” instruction or if we are in any other ISPF panel and issue the “TSO EXEC ….” in the command line. I know almost nothing about ISPF, but I suspect in these cases, ISPF sends the command directly to TSO, without any further analysis.

Thanks again!
Regards, Ricardo
Back to top
View user's profile Send private message
Pedro

Senior Member


Joined: 01 Sep 2006
Posts: 2019
Location: Silicon Valley

PostPosted: Wed Dec 04, 2013 4:58 am    Post subject: Reply to: Displaying the value set by the EXIT instruction
Reply with quote

Quote:
... a REXX exec that sometimes runs online and sometimes runs in batch, the user will need to have two versions...

Actually, you should write only one exec, but have it check the environment and have it behave as necessary for that environment.

Code:
If  SysVar('SysEnv') = 'FORE' Then
   Say 'programx is ending with RC=22'
Back to top
View user's profile Send private message
Pedro

Senior Member


Joined: 01 Sep 2006
Posts: 2019
Location: Silicon Valley

PostPosted: Wed Dec 04, 2013 6:46 am    Post subject: Reply to: Displaying the value set by the EXIT instruction
Reply with quote

Quote:
I suspect in these cases, ISPF sends the command directly to TSO, without any further analysis.


I tend to agree. And the problem is likely the evolution of MVS and TSO and ISPF. You are expecting TSO to behave in a more modern fashion than its 1960's overall design. Yes, there have been changes over time, but still not to the level that you expect.

The result is that, if you want to see a message with a return code, you need to display it yourself.
Back to top
View user's profile Send private message
Akatsukami

Global Moderator


Joined: 03 Oct 2009
Posts: 1738
Location: Bloomington, IL

PostPosted: Wed Dec 04, 2013 11:28 pm    Post subject:
Reply with quote

FWIW, executing a Rexx script in the command shell results in a message IQIP628 EX ended. Return code of n. Executing it from an ISPF command line results in short message EX RC(n). z/OS 1.13 and ISPF 6.3 here; YMMV.
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 display value of an exit param... lind sh CICS 2 Sun Oct 09, 2016 12:28 pm
No new posts A sample of exit program for exit XMN... lind sh CICS 2 Mon Oct 03, 2016 5:07 pm
No new posts SORT - E15 and E35 using same user ex... Abhi Nature DFSORT/ICETOOL 12 Mon Oct 03, 2016 4:33 pm
No new posts How to use my exit program. lind sh CICS 1 Tue Sep 13, 2016 1:54 pm
No new posts User exit in COBOL programs ganasrinivasan PL/I & Assembler 0 Thu Aug 18, 2016 12:48 pm


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