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 call the function ??

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

Active User


Joined: 09 Jun 2014
Posts: 106
Location: windsor

PostPosted: Wed Jun 25, 2014 12:50 am    Post subject: how to call the function ??
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

Senior Member


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

PostPosted: Wed Jun 25, 2014 1:27 am    Post subject: Reply to: how to call the function ??
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    Post subject:
Reply with quote

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

Active User


Joined: 09 Jun 2014
Posts: 106
Location: windsor

PostPosted: Wed Jun 25, 2014 1:43 am    Post subject:
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: 1738
Location: Bloomington, IL

PostPosted: Wed Jun 25, 2014 2:41 am    Post subject: Re: how to call the function ??
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: 106
Location: windsor

PostPosted: Wed Jun 25, 2014 6:20 pm    Post subject: answer
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: 1738
Location: Bloomington, IL

PostPosted: Wed Jun 25, 2014 6:34 pm    Post subject:
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: 106
Location: windsor

PostPosted: Wed Jun 25, 2014 8:16 pm    Post subject: Answer
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: 1738
Location: Bloomington, IL

PostPosted: Wed Jun 25, 2014 8:40 pm    Post subject: Re: Answer
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

Senior Member


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

PostPosted: Wed Jun 25, 2014 9:12 pm    Post subject: Reply to: how to call the function ??
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: 106
Location: windsor

PostPosted: Wed Jun 25, 2014 11:20 pm    Post subject: answer
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: 1738
Location: Bloomington, IL

PostPosted: Wed Jun 25, 2014 11:40 pm    Post subject:
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: 106
Location: windsor

PostPosted: Thu Jun 26, 2014 2:02 am    Post subject: answer
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    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
This topic is locked: you cannot edit posts or make replies. RANDOM Function in COBOL swapnil781 COBOL Programming 2 Tue Nov 15, 2016 6:17 pm
No new posts Check System time(Minute) Using TIME1... balaji81_k DFSORT/ICETOOL 5 Fri Nov 11, 2016 10:53 am
No new posts Cobol EZASOKET call to SETSOCKOPT fails Andi1982 COBOL Programming 6 Thu Oct 06, 2016 7:12 pm
No new posts Strange EXEC function call in z/VM Willy Jensen CLIST & REXX 3 Wed Oct 05, 2016 2:07 pm
No new posts Replace function abdulrafi COBOL Programming 13 Mon Sep 12, 2016 10:12 am


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