Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to pass value from one program to another

Status
Not open for further replies.

shuhaibk54

Technical User
Jun 12, 2012
18
IN
Hi,

I am pretty new in the rexx coding I have a requierement to pass value from one to another program can any one help me out on this ..i tried to wite the code(see belwo simple code for model )

Explanation:fisrt calling prgm get the data from user and call the second pgm(called) with passing value .other pgm trying to get the value from first and dispaly it..But i am getting below error ...

IRX0043I Error running CALL, line 4: Routine not found (both pgm are in same PDS)


calling:
------------------------------
/* REXX*/
PULL DATE
ARG1 = SUBSTR(DATE,1,2)
CALL RESULT(ARG1)

--called----------------------------
/* REXX */
ARG DATE1
SAY DATE1
------------------------------
 
Both programs are in the same PDS, but how are you invoking the first? "EXEC some.dataset(first) exec"? It sounds as though the enclosing dataset is not allocated in a place where it's accessible.

Frank Clarke
--America's source for adverse opinions since 1943.
 
This is the modified code and below are the trace out command result ..

000001 /* REXX*/
000002 TRACE I
000003 PULL DATE
000004 ARG1 = SUBSTR(DATE,1,2)
000005 "EXEC ABC.BBC.REXX(CALLED) EXEC "
-----------------------------------------------------------------


4 *-* ARG1 = SUBSTR(DATE,1,2)
>V> "1/12/2012"
>L> "1"
>L> "2"
>F> "1/"
5 *-* "EXEC EXEC ABC.BBC.REXX(CALLED) EXEC "
>L> "EXEC ABC.BBC.REXX(CALLED) EXEC "
IKJ56228I DATA SET EXEC ABC.BBC.REXX.EXEC NOT IN CATALOG OR CATALOG CAN NOT BE A
cCESSED
+++ RC(12) +++
***




 
Code:
"EXEC EXEC ABC.BBC.REXX(CALLED) EXEC "

This is not the original code. Are we diagnosing a moving target?

Why are there two "EXEC"s in front? Pay special attention to the fine detail in the message:

Code:
DATA SET EXEC ABC.BBC.REXX.EXEC NOT IN CATALOG OR CATALOG CAN NOT BE ACCESSED

Frank Clarke
--America's source for adverse opinions since 1943.
 
Two programs - the first is called by the second. Put both in the same PDS that is allocated to SYSEXEC or, on the toy, into the same folder and exec the second.
/*- Rexx ------------------------------------------------------------*/
/* */
/* */
/* */
/*------------------------------------------------------------ Rexx -*/
Say 'This is Rexx exec CALLEE'
Return
This is the second which is the one executed at the command line
/*- Rexx ------------------------------------------------------------*/
/* */
/* */
/* */
/*------------------------------------------------------------ Rexx -*/
Say 'This is Rexx exec CALLER'
/* Call callee */
'callee'
Say 'This is Rexx exec CALLER - again'

I have just run, successfully, on both zOS znd Win XP


Nic
 
I know that obviously this code will be working .I meant calling from one program to another. But my requirement is passing a value from one program to another..Please help me know the code for passing vale to another pgm..


Thanks,
Shuhaib
 
Sorry, I had similar progrma names that did pass data back and forth but obviously forgot about that requirement when testing and posting. Don't know where they are at the moment - certainly not on this machine but may be on floppy somewhere as I looked on my work pen drive and did not find them. Or they may be on a another machine - unlikely. But I think you only have to do something like:
Code:
parm_data = 'some data'
 "callee "parm_data

The return of data would be via the RETURN statement


Nic
 
Right, this modified version of the calling program works on the PC and should work on the mainframe...
Code:
/*- Rexx ------------------------------------------------------------*/
/*                                                                   */
/*                                                                   */
/*                                                                   */
/*------------------------------------------------------------ Rexx -*/
Trace 'O'

Say 'This is Rexx exec CALLER'                                         
/* Call callee */                                                      
parm_data = 'This is some data'
'callee' parm_data                                                     

Say 'This is Rexx exec CALLER - again'

and this is the called program
Code:
/*- Rexx ------------------------------------------------------------*/
/*                                                                   */
/*                                                                   */
/*                                                                   */
/*------------------------------------------------------------ Rexx -*/
trace 'O'

Say 'This is Rexx exec CALLEE'                                         
Parse Arg parm_in
Say 'The data received was: 'parm_in
Say 'Bye Bye from exec CALLEE'                                         
Return



Nic
 
Perfect code ... thanks a lot nclouston (Programmer)...It worked perfectly in my side .... again and again I am saying tek-tips helping me a lot to study and build a rexx code.Thanks once again !!


Modified code ..
------------------------------------
/*- REXX ------------------------------------------------------------*/
/* */
/* */
/* */
/*------------------------------------------------------------ REXX -*/
TRACE 'O'
SAY 'THIS IS REXX EXEC CALLER'
/* CALL CALLEE */
PARM_DATA = 'THIS IS SOME DATA'
/*'CALLEE' PARM_DATA*/
CALL 'CALLEE'PARM_DATA /*Edited line */
SAY 'THIS IS REXX EXEC CALLER - AGAIN'
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top