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
 

 

Call REXX code as a function.

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CLIST & REXX
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    Post subject: Call REXX code as a function.
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: 2360
Location: Israel

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

Try to change you RETURN(RC1) to EXIT RC1

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

Moderator Team Head


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

PostPosted: Wed Jan 28, 2009 7:17 pm    Post subject: Reply to: Call REXX code as a function.
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    Post subject: Re: Reply to: Call REXX code as a function.
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

Moderator Team Head


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

PostPosted: Wed Jan 28, 2009 7:42 pm    Post subject: Reply to: Call REXX code as a function.
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    Post subject: Re: Reply to: Call REXX code as a function.
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

Moderator Team Head


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

PostPosted: Wed Jan 28, 2009 7:50 pm    Post subject: Reply to: Call REXX code as a function.
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    Post subject: Reply to: Call REXX code as a function.
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    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 JCL to Set Return code based on DB2 S... vinu78 DB2 17 Mon Mar 13, 2017 9:47 pm
No new posts REXX cdoe to purge a JOB from spool a... Sulabh Agrawal CLIST & REXX 11 Thu Mar 09, 2017 11:36 am
No new posts IMS region inactive - User abend code... gthmrj IMS DB/DC 5 Tue Mar 07, 2017 12:29 pm
No new posts Overriding PS data in rexx Shaheen Shaik CLIST & REXX 8 Fri Mar 03, 2017 5:08 pm
No new posts CA Workload Automation event code help vinu78 CA Products 10 Wed Mar 01, 2017 10:05 am


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