View previous topic :: View next topic
|
Author |
Message |
sushanth bobby
Senior Member
Joined: 29 Jul 2008 Posts: 1020 Location: India
|
|
|
|
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 |
|
|
sushanth bobby
Senior Member
Joined: 29 Jul 2008 Posts: 1020 Location: India
|
|
|
|
Hey,
Got it
Code: |
CALL CALLED 'SUSHANTH' |
What is the difference between CALL & EXEC ?
Sushanth |
|
Back to top |
|
|
superk
Global Moderator
Joined: 26 Apr 2004 Posts: 4652 Location: Raleigh, NC, USA
|
|
|
|
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 |
|
|
Pedro
Global Moderator
Joined: 01 Sep 2006 Posts: 2547 Location: Silicon Valley
|
|
|
|
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 |
|
|
sushanth bobby
Senior Member
Joined: 29 Jul 2008 Posts: 1020 Location: India
|
|
|
|
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 |
|
|
Pedro
Global Moderator
Joined: 01 Sep 2006 Posts: 2547 Location: Silicon Valley
|
|
|
|
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 |
|
|
sushanth bobby
Senior Member
Joined: 29 Jul 2008 Posts: 1020 Location: India
|
|
|
|
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 |
|
|
Pedro
Global Moderator
Joined: 01 Sep 2006 Posts: 2547 Location: Silicon Valley
|
|
|
|
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 |
|
|
sushanth bobby
Senior Member
Joined: 29 Jul 2008 Posts: 1020 Location: India
|
|
|
|
Oh 0.k PEDRO,
Thanks for information. |
|
Back to top |
|
|
janaonline
New User
Joined: 13 Dec 2007 Posts: 11 Location: USA, California
|
|
|
|
Thanks guys!!!!
This was actually very useful for me and completed my assignment...
This forum is amazing.....
|
|
Back to top |
|
|
|