Receive value from called REXX to calling REXX



IBM's Command List programming language & Restructured Extended Executor

Receive value from called REXX to calling REXX

Postby nikesh_rai » Thu Feb 21, 2013 11:47 pm

Hi,

Is it possible to receive value from a rexx module. A rexx module REXX1 is calling another rexx module REXX2 with call statement:

CALL REXX2 XSUBSYS,XCRTRID,XTBLNME,XINPFLE,SQLRTCD


the value for SQLRTCD is being processed in REXX2, and I want to receive it in REXX1. Can you please suggest me on this..
Thanks
Nikesh Rai
nikesh_rai
 
Posts: 205
Joined: Tue Oct 18, 2011 1:27 am
Has thanked: 17 times
Been thanked: 0 time

Re: Receive value from called REXX to calling REXX

Postby Akatsukami » Fri Feb 22, 2013 12:04 am

I suggest that you either use ISPF VGET/VPUT services, or roll your own equivalents (if absolutely necessary).
"You have sat too long for any good you have been doing lately ... Depart, I say; and let us have done with you. In the name of God, go!" -- what I say to a junior programmer at least once a day
User avatar
Akatsukami
Global moderator
 
Posts: 1058
Joined: Sat Oct 16, 2010 2:31 am
Location: Bloomington, IL
Has thanked: 6 times
Been thanked: 51 times

Re: Receive value from called REXX to calling REXX

Postby enrico-sorichetti » Fri Feb 22, 2013 12:10 am

unfortunately what You ask for cannot be obtained by simple means

also in IT using the right terminology is essential for good communication

using the word module implies that You are running a compiled REXX , the name tells, modules
not an interpreted one

if You describe better the environment somebody might have better suggestions
cheers
enrico
When I tell somebody to RTFM or STFW I usually have the page open in another tab/window of my browser,
so that I am sure that the information requested can be reached with a very small effort
enrico-sorichetti
Global moderator
 
Posts: 3003
Joined: Fri Apr 18, 2008 11:25 pm
Has thanked: 0 time
Been thanked: 164 times

Re: Receive value from called REXX to calling REXX

Postby Pedro » Fri Feb 22, 2013 3:23 am

Try calling it as a function:

SQLRTCD1  =  REXX2(XSUBSYS,XCRTRID,XTBLNME,XINPFLE)


where REXX2 ends with:
EXIT SQLRTCD
Pedro Vera
User avatar
Pedro
 
Posts: 686
Joined: Thu Jul 31, 2008 9:59 pm
Location: Silicon Valley
Has thanked: 0 time
Been thanked: 53 times

Re: Receive value from called REXX to calling REXX

Postby nikesh_rai » Fri Feb 22, 2013 12:00 pm

One more issue is there, the value I am passing from Rexx1 to Rexx2 is not being received in Rexx2. I tried to display the values and all are coming as blank.. is there anything I need to include in my code:

Rexx1:

CALL REXX2 XSUBSYS,XCRTRID,XTBLNME,XINPFLE,SQLRTCD


Rexx2:
SAY XSUBSYS                                     
SAY XCRTRID                                     
SAY XTBLNME                                     
ADDRESS ISPEXEC                                 
"VPUT(XSUBSYS,XCRTRID,XTBLNME)"                 
SAY XSUBSYS                                     
SAY XCRTRID                                     
SAY XTBLNME                                     
ADDRESS TSO 'SUBCOM DSNREXX'                     
IF RC = 1 THEN DO                               
   S_RC = RXSUBCOM('ADD','DSNREXX','DSNREXX')   
END                                             
Thanks
Nikesh Rai
nikesh_rai
 
Posts: 205
Joined: Tue Oct 18, 2011 1:27 am
Has thanked: 17 times
Been thanked: 0 time

Re: Receive value from called REXX to calling REXX

Postby enrico-sorichetti » Fri Feb 22, 2013 12:41 pm

in the called function/subroutine You will have to <PARSE> the arglist or use the ARG(...) function

but... why not meditate a bit more on the manuals :geek:
cheers
enrico
When I tell somebody to RTFM or STFW I usually have the page open in another tab/window of my browser,
so that I am sure that the information requested can be reached with a very small effort

These users thanked the author enrico-sorichetti for the post:
nikesh_rai (Sat Feb 23, 2013 12:28 pm)
enrico-sorichetti
Global moderator
 
Posts: 3003
Joined: Fri Apr 18, 2008 11:25 pm
Has thanked: 0 time
Been thanked: 164 times

Re: Receive value from called REXX to calling REXX

Postby nikesh_rai » Fri Feb 22, 2013 12:54 pm

Thanks Enrico,

Checked manulas... ARG is working for me.. my second issue has been resolved.. but not the first one.. :)
I am checking manuals for the Ist issue as well.. if got something.. will update here... and if not.. I will back again.. ;)
Thanks
Nikesh Rai
nikesh_rai
 
Posts: 205
Joined: Tue Oct 18, 2011 1:27 am
Has thanked: 17 times
Been thanked: 0 time

Re: Receive value from called REXX to calling REXX

Postby nikesh_rai » Fri Feb 22, 2013 3:13 pm

Got the 1st one also.. thanks Pedro.. you suggestion worked.. :)
Thanks to Enrico as well... :)

here is the code for refrence:

Rexx1:

CALL REXX2 XSUBSYS,XCRTRID,XTBLNME,XINPFLE,SQLRTCD 
SQLRTCD = REXX2(XSUBSYS,XCRTRID,XTBLNME,XINPFLE)   


Rexx2:

ARG XSUBSYS,XCRTRID,XTBLNME,XINPFLE,SQLRTCD     
SAY 'NIK1 ' XSUBSYS                             
SAY 'NIK2 ' XCRTRID                             
SAY 'NIK3 ' XTBLNME                             
SAY 'NIK4 ' XINPFLE                             
SAY 'NIK5 ' SQLRTCD                             
.......

IF (SQLCD1 ¬= 0 | SQLCD2 ¬= 0 | SQLCD3 ¬= 0 | SQLCD4 ¬= 0 |  ,   
    SQLCD5 ¬= 0 | SQLCD6 ¬= 0 | SQLCD7 ¬= 0 ) THEN               
    DO                                                           
       SQLRTCD = 1                                               
    END                                                         
ELSE                                                             
    DO                                                           
       IF SQLDA1 = 0 THEN                                       
          SQLRTCD = 2                                           
       ELSE DO                                                   
          SQLRTCD = 3                                           
       END                                                       
    END                                                         
                                                                 
RETURN (SQLRTCD)                                                 


Thanks
Nikesh
Thanks
Nikesh Rai
nikesh_rai
 
Posts: 205
Joined: Tue Oct 18, 2011 1:27 am
Has thanked: 17 times
Been thanked: 0 time

Re: Receive value from called REXX to calling REXX

Postby Pedro » Fri Feb 22, 2013 7:34 pm

CALL REXX2 XSUBSYS,XCRTRID,XTBLNME,XINPFLE,SQLRTCD
SQLRTCD = REXX2(XSUBSYS,XCRTRID,XTBLNME,XINPFLE)


You are calling REXX2 twice: once as an external routine and again as an external function. You do not need the first instance.
Pedro Vera

These users thanked the author Pedro for the post:
nikesh_rai (Sat Feb 23, 2013 12:28 pm)
User avatar
Pedro
 
Posts: 686
Joined: Thu Jul 31, 2008 9:59 pm
Location: Silicon Valley
Has thanked: 0 time
Been thanked: 53 times

Re: Receive value from called REXX to calling REXX

Postby nikesh_rai » Sat Feb 23, 2013 12:27 pm

Thanks Pedro...

deleted first line.. and it is still working.. Thanks.. :)
Thanks
Nikesh Rai
nikesh_rai
 
Posts: 205
Joined: Tue Oct 18, 2011 1:27 am
Has thanked: 17 times
Been thanked: 0 time


Return to CLIST & REXX

 


  • Related topics
    Replies
    Views
    Last post