IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

how to call the function ??


IBM Mainframe Forums -> CLIST & REXX
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
jackzhang75

Active User


Joined: 09 Jun 2014
Posts: 125
Location: US

PostPosted: Wed Jun 25, 2014 12:50 am
Reply with quote

Hi guys,

I have two rexx progrom , both of these stored in same PDS. From REXX A i just want to call REXXB and pass the value of DATA to REXXB , the code as following, it seems it not working properly. What's wrong? Thanks

DATA is just name of PDS . When i submit the jcl it will pass data to REXXA

REXX A
/* REXX */
ARG DATA JOBNAME DAY
CALL FUNCTION DATA

REXX B
/* REXX */
PARSE ARG DATA
"ALLOC DA("DATA") F(INDD) SHR REUSE"
"EXECIO * DISKR INDD (STEM UL0."
Back to top
View user's profile Send private message
Pedro

Global Moderator


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

PostPosted: Wed Jun 25, 2014 1:27 am
Reply with quote

Assuming your rexx library is in your SYSPROC or SYSEXEC concatenation:
Code:
Address TSO "%REXXB" data

or if not in your concatenation:
Code:
Address TSO "CALL 'my.exec.lib(REXXB)' '"data"'"
Back to top
View user's profile Send private message
Mickeydusaor

Active User


Joined: 24 May 2006
Posts: 258
Location: Salem, Oregon

PostPosted: Wed Jun 25, 2014 1:33 am
Reply with quote

call rexxb data
Back to top
View user's profile Send private message
jackzhang75

Active User


Joined: 09 Jun 2014
Posts: 125
Location: US

PostPosted: Wed Jun 25, 2014 1:43 am
Reply with quote

sorry my tpying mistake , the code should be

call rexxb data
Back to top
View user's profile Send private message
Akatsukami

Global Moderator


Joined: 03 Oct 2009
Posts: 1788
Location: Bloomington, IL

PostPosted: Wed Jun 25, 2014 2:41 am
Reply with quote

jackzhang75 wrote:
Hi guys,

I have two rexx progrom , both of these stored in same PDS. From REXX A i just want to call REXXB and pass the value of DATA to REXXB , the code as following, it seems it not working properly.

How is it "not working properly"? Error messages, non-zero return codes, unexpected results? Why didn't you show us any of these things?

Did you TRACE the execution? If so, why didn't you post the trace? If not, run with TRACE I or TRACE R, and then post the output.
Back to top
View user's profile Send private message
jackzhang75

Active User


Joined: 09 Jun 2014
Posts: 125
Location: US

PostPosted: Wed Jun 25, 2014 6:20 pm
Reply with quote

My REXXA is pass DATA to REXXB ,

Code:
REXXA.
 DROP UL0.                                                           
 "ALLOC DA("DATA") F(INDD) SHR REUSE"                                 
 "EXECIO  *  DISKR  INDD  (STEM UL0."                                 
 QUEUE '//TU14CPY  JOB (T,TSP,TSP8000,4,WD33),''HAO ZHANG'','         
 QUEUE '//             CLASS=4,MSGCLASS=T,                           
 QUEUE '//             NOTIFY=TU14                                   
 QUEUE '//***  THIS JCL WAS GENERATED BY REXX  'DATE()' 'TIME()'  ***/
 /********************************************************************
 CALL FUNCTION DATA       


REXXB:

Code:
 /* REXX */                         
 PARSE ARG DATA                     
 "ALLOC DA("DATA") F(INDD) SHR REUSE"
 "EXECIO  *  DISKR  INDD  (STEM UL0."
 DO CU=1 TO UL0.0                       
 DROP LOADMODULE TYPE                   
 PARSE VALUE UL0.CU WITH LOADMODULE TYPE
 IF TYPE='SLCXCNTL' THEN                 
   OPTIONA=C                           
 IF TYPE='SLCXEXEC' THEN                 
   OPTIONB=E 



then it shows :
Code:
       >O>   "//***  THIS JCL WAS GENERATED BY REXX  25 Ju
    29 *-* /**********************************************
    30 *-* CALL FUNCTION DATA                             
       >V>   "'TTAT.TSP.TU14.REXX(OUTPUT)'"               
IKJ56861I  FILE INDD NOT UNALLOCATED, DATA SET IS OPEN   
Back to top
View user's profile Send private message
Akatsukami

Global Moderator


Joined: 03 Oct 2009
Posts: 1788
Location: Bloomington, IL

PostPosted: Wed Jun 25, 2014 6:34 pm
Reply with quote

Use the FINIS keyword on your EXECIO command.
Back to top
View user's profile Send private message
jackzhang75

Active User


Joined: 09 Jun 2014
Posts: 125
Location: US

PostPosted: Wed Jun 25, 2014 8:16 pm
Reply with quote

Hi,

Thanks for your answer.
I used FINIS keyword in my REXXA. And now i got two questions.

1. After i use FINIS in REXXA , I can't read every record from input file..
In my progrom , i need read every reocord and store this value to the array variale.

Code:
DO CU=1 TO UL0.0                                               
DROP LOADMODULE                                               
PARSE VALUE UL0.CU WITH LOADMODULE TYPE                       
    SELECT                                                     
      WHEN TYPE = 'SLCXCNTL' THEN  DO                         
       TL.CU='              SELECT MEMBER=('||LOADMODULE||')' 
       SAY TL.CU     

2. Second questio is , is the function only return one value?
because my REXXB have many value need to return to REXXA , eg , all the value form OPTION* variable.

How to make it work? or i can't use call function method..

Code:
/* REXX */                                 
 PARSE ARG DATA                             
 "ALLOC DA("DATA") F(INDD) SHR REUSE"       
 "EXECIO  *  DISKR  INDD  (STEM UL0."       
 OPTIONA=''                                 
 OPTIONB=''                                 
 OPTIONC=''                                 
 OPTIOND=''                                 
 OPTIONE=''                                 
 OPTIONF=''                                 
 OPTIONG=''                                 
 DO CU=1 TO UL0.0                           
 DROP LOADMODULE TYPE                       
 PARSE VALUE UL0.CU WITH LOADMODULE TYPE   
 IF TYPE='SLCXCNTL' THEN                   
    OPTIONA=C                               
 IF TYPE='SLCXEXEC' THEN                   
    OPTIONB=E         
 IF TYPE='SLCXLOAD' THEN                                   
   OPTIONC=L                                               
IF TYPE='SLCXAUTH' THEN                                   
   OPTIOND=A                                               
IF TYPE='SLCXMENU' THEN                                   
   OPTIONE=M                                               
IF TYPE='SLCXPENU' THEN                                   
   OPTIONF=P                                               
IF TYPE='SLCXSENU' THEN                                   
   OPTIONG=S                                               
END                                                       
SAY OPTIONA OPTIONB OPTIONC OPTIOND OPTIONE OPTIONF OPTIONG
RETURN    OPTIONA OPTIONB OPTIONC OPTIOND OPTIONE OPTIONF
Back to top
View user's profile Send private message
Akatsukami

Global Moderator


Joined: 03 Oct 2009
Posts: 1788
Location: Bloomington, IL

PostPosted: Wed Jun 25, 2014 8:40 pm
Reply with quote

jackzhang75 wrote:
Hi,

Thanks for your answer.
I used FINIS keyword in my REXXA. And now i got two questions.

1. After i use FINIS in REXXA , I can't read every record from input file..
In my progrom , i need read every reocord and store this value to the array variale.


Note that "EXECIO * DISKR INDD (STEM UL0." does reads every record from the data set allocated to INDD, places those records in the stem ULU., and places the total number of records in the variable ULU.0; that is specified by the asterisk in the place of the number of records. The addition of the FINIS keyword closes the file, allowing the data set to be de-allocated (freed). You cannot read from the file after closing it, but neither do you need to, as you have already read to EOF. If you are trying to accomplish something else, you need to explain what.

Quote:
2. Second questio is , is the function only return one value?
because my REXXB have many value need to return to REXXA , eg , all the value form OPTION* variable.

How to make it work? or i can't use call function method..

Code:
/* REXX */                                 
 PARSE ARG DATA                             
 "ALLOC DA("DATA") F(INDD) SHR REUSE"       
 "EXECIO  *  DISKR  INDD  (STEM UL0."       
 OPTIONA=''                                 
 OPTIONB=''                                 
 OPTIONC=''                                 
 OPTIOND=''                                 
 OPTIONE=''                                 
 OPTIONF=''                                 
 OPTIONG=''                                 
 DO CU=1 TO UL0.0                           
 DROP LOADMODULE TYPE                       
 PARSE VALUE UL0.CU WITH LOADMODULE TYPE   
 IF TYPE='SLCXCNTL' THEN                   
    OPTIONA=C                               
 IF TYPE='SLCXEXEC' THEN                   
    OPTIONB=E         
 IF TYPE='SLCXLOAD' THEN                                   
   OPTIONC=L                                               
IF TYPE='SLCXAUTH' THEN                                   
   OPTIOND=A                                               
IF TYPE='SLCXMENU' THEN                                   
   OPTIONE=M                                               
IF TYPE='SLCXPENU' THEN                                   
   OPTIONF=P                                               
IF TYPE='SLCXSENU' THEN                                   
   OPTIONG=S                                               
END                                                       
SAY OPTIONA OPTIONB OPTIONC OPTIOND OPTIONE OPTIONF OPTIONG
RETURN    OPTIONA OPTIONB OPTIONC OPTIOND OPTIONE OPTIONF

Only one value can be returned; however, since this is an inter-Rexx call, it can be a string. Concatenate the OPTIONx variables with a suitable delimiter (one that will not appear in a valid value) and return that.
Back to top
View user's profile Send private message
Pedro

Global Moderator


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

PostPosted: Wed Jun 25, 2014 9:12 pm
Reply with quote

After the call instruction, use the 'RESULT' special variable to refer to REXXB's response.

Code:
/* rexx */           
Call rexxb someparm 
Say result           
exit                 
Back to top
View user's profile Send private message
jackzhang75

Active User


Joined: 09 Jun 2014
Posts: 125
Location: US

PostPosted: Wed Jun 25, 2014 11:20 pm
Reply with quote

hi Akatsukami,

Thanks for your answer.

For question one. i change to
"ALLOC DA("DATA") F(INDD) SHR REUSE"
"EXECIO * DISKR INDD (STEM UL0."
"EXECIO * DISKR INDD (FINIS"

which was good for now, it can read everything and closed it.

For question 2, i still confusing , could you give me a example ?

Thanks!!
Back to top
View user's profile Send private message
Akatsukami

Global Moderator


Joined: 03 Oct 2009
Posts: 1788
Location: Bloomington, IL

PostPosted: Wed Jun 25, 2014 11:40 pm
Reply with quote

Well, I'm away from my mainframe connection, so I can't test, but the code will be something like this
Code:
(other logic)
return optiona";"optionb";"optionc";"optiond";"optione";"optionf";"optiong

This returns the values separated by semi-colons. In the calling script, you can then decompose it by:
Code:
parse var result optiona ";" optionb ";" optionc ";" optiond ";" optione ";" optionf ";" optiong
Back to top
View user's profile Send private message
jackzhang75

Active User


Joined: 09 Jun 2014
Posts: 125
Location: US

PostPosted: Thu Jun 26, 2014 2:02 am
Reply with quote

Hi ,it runs perfectly !!! Thanks for your help!!
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> CLIST & REXX

 


Similar Topics
Topic Forum Replies
No new posts Calling an Open C library function in... CICS 1
No new posts DATE2 function SYNCSORT 15
No new posts Help on PL/I jsonPutValue function PL/I & Assembler 8
No new posts Error while running web tool kit REXX... CLIST & REXX 5
No new posts Call program, directly from panel CLIST & REXX 9
Search our Forums:

Back to Top