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

Call REXX code as a function.


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

New User


Joined: 13 Jan 2009
Posts: 36
Location: India

PostPosted: Wed Jan 28, 2009 7:04 pm
Reply with quote

Hi all,

Could you please guide me as how to call a REXX program from a CLIST as a function. The REXX code returns a numeric value.

Currently i am calling the REXX program as %TSTCLIS1 &RDSN in CLIST Code.

Please see the code below.

CLIST:
Code:

PROC 0                                     
   CONTROL LIST CONLIST SYMLIST MSG         
   SET &RDSN = &STR(CAE.ASD.RPT) 
   %TSTCLIS1 &RDSN               
EXIT                                       


REXX:
Code:

/*REXX - */
TRACE  "I"                                                             
PARSE UPPER ARG RDSN                                           
ADDRESS TSO "ALLOCATE F(MEMDD) DSN('"RDSN"') SHR"                     
RC1 = RC                                                               
ADDRESS TSO "EXECIO 1 DISKR MEMDD ( FINIS STEM DATA."
SAY 'RC2 ==> ' RC                                                     
RETURN(RC1)                                                           


I want to use RC1 in my CLIST code.
Could you please guide me how to do this?
Back to top
View user's profile Send private message
ofer71

Global Moderator


Joined: 27 Dec 2005
Posts: 2358
Location: Israel

PostPosted: Wed Jan 28, 2009 7:17 pm
Reply with quote

Try to change you RETURN(RC1) to EXIT RC1

O.
Back to top
View user's profile Send private message
superk

Global Moderator


Joined: 26 Apr 2004
Posts: 4652
Location: Raleigh, NC, USA

PostPosted: Wed Jan 28, 2009 7:17 pm
Reply with quote

Everything appears to be OK from what I can see. Is there a problem?
Back to top
View user's profile Send private message
Akash Sharma

New User


Joined: 13 Jan 2009
Posts: 36
Location: India

PostPosted: Wed Jan 28, 2009 7:34 pm
Reply with quote

superk wrote:
Everything appears to be OK from what I can see. Is there a problem?


The problem here is that i am not able to get any value for &RC1 in CLIST.
The value im geeting for that while displaying in CLIST is spaces.

i.e.
Code:

PROC 0
   CONTROL LIST CONLIST SYMLIST MSG         
   SET &RDSN = &STR(CAE.ASD.RPT) 
   %TSTCLIS1 &RDSN
   WRITE RETURN FROM REX==> &RC1
EXIT


But the REXX program is returning a value of 12 as return code.
see below the trace:

Code:

 12 *-* EXIT RC1   
    >V>   "12"     
WRITE RETURN FROM REX==> &RC1   
WRITE RETURN FROM REX==>       
RETURN FROM REX==>             
EXIT                           
EXIT                           
***                             


Please help..
Back to top
View user's profile Send private message
superk

Global Moderator


Joined: 26 Apr 2004
Posts: 4652
Location: Raleigh, NC, USA

PostPosted: Wed Jan 28, 2009 7:42 pm
Reply with quote

WRITE RETURN FROM REXX==> &LASTCC would work correctly.
Back to top
View user's profile Send private message
Akash Sharma

New User


Joined: 13 Jan 2009
Posts: 36
Location: India

PostPosted: Wed Jan 28, 2009 7:48 pm
Reply with quote

superk wrote:
WRITE RETURN FROM REXX==> &LASTCC would work correctly.


Thanks a lot superk...
It is working now. That's a big relief.... icon_biggrin.gif
Back to top
View user's profile Send private message
superk

Global Moderator


Joined: 26 Apr 2004
Posts: 4652
Location: Raleigh, NC, USA

PostPosted: Wed Jan 28, 2009 7:50 pm
Reply with quote

One additional thought. If you are ultimately looking to be able to pass values or strings between a CLIST and a REXX exec, I'd suggest that you look into using ISPF global or profile variables as the means of doing so.
Back to top
View user's profile Send private message
Akash Sharma

New User


Joined: 13 Jan 2009
Posts: 36
Location: India

PostPosted: Wed Jan 28, 2009 8:47 pm
Reply with quote

Hi...Just a small query...
Whats the command to supress error messages in REXX?

Thanks for the wonderful help im getting in the forum. icon_smile.gif
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 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
No new posts Execute secondary panel of sdsf with ... CLIST & REXX 1
Search our Forums:

Back to Top