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
 

 

How to pass parameters to another REXX program

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

Senior Member


Joined: 29 Jul 2008
Posts: 1013
Location: India

PostPosted: Mon Jan 05, 2009 5:39 pm    Post subject: How to pass parameters to another REXX program
Reply with quote

Hi,

I have this caller program(main program)
Code:
/**** REXX ************************************/
SAY 'MAIN PRG'                                   
EX 'REXX.EXEC(CALLED)' 'SUSHANTH' EX             


This is the sub-program which is also in the same PDS. the name of the program is CALLED
Code:
/**** REXX ************************************/     
SAY 'IN-SUB'                                         
ARG PARM1                                           
SELECT                                               
 WHEN PARM1='SUSHANTH' THEN SAY 'HELLO SUSHANTH'     
 OTHERWISE SAY 'WHO ARE YOU ? WHAT IS YOUR PURPOSE ?'
END                                                 


Invalid keyword, sushanth is coming as error message.

this is the trace information
Code:
MAIN PRG                                       
     4 *-* EX 'REXX.EXEC(CALLED)' 'SUSHANTH' EX
       >L>   "EX"                             
        >L>   "REXX.EXEC(CALLED)"               
        >O>   "EX REXX.EXEC(CALLED)"             
        >L>   "SUSHANTH"                         
        >O>   "EX REXX.EXEC(CALLED) SUSHANTH"   
        >L>   "EX"                               
        >O>   "EX REXX.EXEC(CALLED) SUSHANTH EX"
 INVALID KEYWORD, SUSHANTH                       
        +++ RC(12) +++                           


Sushanth
Back to top
View user's profile Send private message

sushanth bobby

Senior Member


Joined: 29 Jul 2008
Posts: 1013
Location: India

PostPosted: Mon Jan 05, 2009 5:48 pm    Post subject:
Reply with quote

Hey,

Got it
Code:
CALL CALLED 'SUSHANTH'   


What is the difference between CALL & EXEC ?

Sushanth
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: Mon Jan 05, 2009 8:17 pm    Post subject: Reply to: How to pass parameters to another REXX program
Reply with quote

Interesting problem. I was looking in the TSO/E REXX documentation and I double-checked that against MVS/Quick-Ref for REXX and I couldn't find any evidence of a REXX instruction or function called "EX" or "EXEC". As far as I know, EXEC is a TSO command, as issuing the command "TSO HELP EXEC" gave me the description of the command. I don't know why when coded the way you did the REXX Interpreter doesn't return an error message such as
"IKJ56500I COMMAND EX NOT FOUND", but it doesn't.

To answer your question, EXEC is a TSO/E command, as is CALL. The difference given between them is:

"THE EXEC COMMAND INITIATES EXECUTION OF A COMMAND PROCEDURE."

"The CALL command loads and executes programs in executable form."

There is a TSO/E REXX "CALL" instruction which is used to Call a sub-routine or procedure, with the control returned back to the line of code immediately following the CALL instruction.
Back to top
View user's profile Send private message
Pedro

Senior Member


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

PostPosted: Mon Jan 05, 2009 10:38 pm    Post subject: Reply to: How to pass parameters to another REXX program
Reply with quote

I agree you should use the rexx CALL instruction.

EXEC would have worked if you used double quotes around your parameters. Both the EXEC statement and rexx host commands use quote characters in their syntax, so in order to make sure the get passed through, you have to use two sets.
Back to top
View user's profile Send private message
sushanth bobby

Senior Member


Joined: 29 Jul 2008
Posts: 1013
Location: India

PostPosted: Tue Jan 06, 2009 10:39 am    Post subject:
Reply with quote

Pedro,

It worked....
Code:
/**** REXX ************************************/ 
SAY 'MAIN PRG'                                   
EX 'REXX.EXEC(CALLED)' "'SUSHANTH'" EX           
/*CALL CALLED 'SUSHANTH'*/                       


Thank You Very Much,
Sushanth Bobby
Back to top
View user's profile Send private message
Pedro

Senior Member


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

PostPosted: Tue Jan 06, 2009 10:16 pm    Post subject: Reply to: How to pass parameters to another REXX program
Reply with quote

It is not clear if you were just testing for curiosity.

Note my previous comment:
Quote:
I agree you should use the rexx CALL instruction.
Back to top
View user's profile Send private message
sushanth bobby

Senior Member


Joined: 29 Jul 2008
Posts: 1013
Location: India

PostPosted: Wed Jan 07, 2009 9:53 am    Post subject:
Reply with quote

Pedro,

I was testing for my curiosity only.
In the real thing, as you said, i will use CALL instruction.

Thank You Very Much,
Sushanth Bobby
Back to top
View user's profile Send private message
Pedro

Senior Member


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

PostPosted: Wed Jan 07, 2009 10:09 pm    Post subject: Reply to: How to pass parameters to another REXX program
Reply with quote

You said this worked:
Code:
/**** REXX ************************************/
SAY 'MAIN PRG'                                   
EX 'REXX.EXEC(CALLED)' "'SUSHANTH'" EX           
/*CALL CALLED 'SUSHANTH'*/ 


But I think there should be more quoted text:
Code:
/**** REXX ************************************/
SAY 'MAIN PRG'                                   
Address TSO
"EX 'REXX.EXEC(CALLED)' 'SUSHANTH' EX "
/*CALL CALLED 'SUSHANTH'*/ 

1. Otherwise you might have problems with dataset prefix. If someone else runs the program, it might not work.

2. very slight performance issue. Rexx will treat all non-quoted strings as variables and try to substitute. For example, the first characters are 'EX'... it will look for a variable named EX will not find one then use the name of the variable in uppercase. You already know it is not a variable, so do not make rexx do the additional processing.
Back to top
View user's profile Send private message
sushanth bobby

Senior Member


Joined: 29 Jul 2008
Posts: 1013
Location: India

PostPosted: Thu Jan 08, 2009 10:21 am    Post subject:
Reply with quote

Oh 0.k PEDRO,
Thanks for information.
Back to top
View user's profile Send private message
janaonline

New User


Joined: 13 Dec 2007
Posts: 11
Location: USA, California

PostPosted: Fri Sep 17, 2010 1:53 am    Post subject: Reply to: How to pass parameters to another REXX program
Reply with quote

Thanks guys!!!!

This was actually very useful for me and completed my assignment...

This forum is amazing.....

icon_smile.gif icon_smile.gif icon_smile.gif icon_smile.gif icon_smile.gif 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 Executing OO COBOL program invoking J... Virendra Shambharkar COBOL Programming 2 Tue Jan 10, 2017 6:37 pm
No new posts Need Suggestion on COBOL program vickey_dw COBOL Programming 5 Thu Jan 05, 2017 10:55 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 JES2 JEC: Use UNIX Pipes to Pass Data... Virendra Shambharkar JCL & VSAM 21 Tue Dec 20, 2016 6:55 pm
No new posts REXX DB2: Dynamic allocation of DB2.D... BHAS CLIST & REXX 3 Mon Dec 19, 2016 8:26 pm


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