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

Displaying the value set by the EXIT instruction


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

New User


Joined: 18 Oct 2012
Posts: 39
Location: Brasil

PostPosted: Tue Dec 03, 2013 5:17 am
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: 8797
Location: Welsh Wales

PostPosted: Tue Dec 03, 2013 12:33 pm
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: 2455
Location: Hampshire, UK

PostPosted: Tue Dec 03, 2013 2:46 pm
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: 39
Location: Brasil

PostPosted: Tue Dec 03, 2013 6:24 pm
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: 8797
Location: Welsh Wales

PostPosted: Tue Dec 03, 2013 7:07 pm
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: 39
Location: Brasil

PostPosted: Tue Dec 03, 2013 7:24 pm
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

Global Moderator


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

PostPosted: Tue Dec 03, 2013 10:28 pm
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: 39
Location: Brasil

PostPosted: Tue Dec 03, 2013 11:22 pm
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

Superior Member


Joined: 14 Mar 2007
Posts: 10872
Location: italy

PostPosted: Tue Dec 03, 2013 11:33 pm
Reply with quote

I already gave You a solution here
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: 39
Location: Brasil

PostPosted: Wed Dec 04, 2013 1:19 am
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

Global Moderator


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

PostPosted: Wed Dec 04, 2013 4:58 am
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

Global Moderator


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

PostPosted: Wed Dec 04, 2013 6:46 am
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: 1788
Location: Bloomington, IL

PostPosted: Wed Dec 04, 2013 11:28 pm
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> CLIST & REXX

 


Similar Topics
Topic Forum Replies
No new posts IBM OnDemand Folders displaying to al... IBM Tools 6
No new posts Use of Perform Thru Exit COBOL Programming 6
No new posts user exit in IBM Infosphere Optim DB2 8
No new posts ACS exit routine JCL & VSAM 0
No new posts Research regarding csqcapx exit CICS 0
Search our Forums:

Back to Top