View previous topic :: View next topic
|
Author |
Message |
jackzhang75
Active User
Joined: 09 Jun 2014 Posts: 125 Location: US
|
|
|
|
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 |
|
|
Pedro
Global Moderator
Joined: 01 Sep 2006 Posts: 2546 Location: Silicon Valley
|
|
|
|
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 |
|
|
Mickeydusaor
Active User
Joined: 24 May 2006 Posts: 258 Location: Salem, Oregon
|
|
|
|
call rexxb data |
|
Back to top |
|
|
jackzhang75
Active User
Joined: 09 Jun 2014 Posts: 125 Location: US
|
|
|
|
sorry my tpying mistake , the code should be
call rexxb data |
|
Back to top |
|
|
Akatsukami
Global Moderator
Joined: 03 Oct 2009 Posts: 1788 Location: Bloomington, IL
|
|
|
|
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 |
|
|
jackzhang75
Active User
Joined: 09 Jun 2014 Posts: 125 Location: US
|
|
|
|
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 |
|
|
Akatsukami
Global Moderator
Joined: 03 Oct 2009 Posts: 1788 Location: Bloomington, IL
|
|
|
|
Use the FINIS keyword on your EXECIO command. |
|
Back to top |
|
|
jackzhang75
Active User
Joined: 09 Jun 2014 Posts: 125 Location: US
|
|
|
|
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 |
|
|
Akatsukami
Global Moderator
Joined: 03 Oct 2009 Posts: 1788 Location: Bloomington, IL
|
|
|
|
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 |
|
|
Pedro
Global Moderator
Joined: 01 Sep 2006 Posts: 2546 Location: Silicon Valley
|
|
|
|
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 |
|
|
jackzhang75
Active User
Joined: 09 Jun 2014 Posts: 125 Location: US
|
|
|
|
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 |
|
|
Akatsukami
Global Moderator
Joined: 03 Oct 2009 Posts: 1788 Location: Bloomington, IL
|
|
|
|
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 |
|
|
jackzhang75
Active User
Joined: 09 Jun 2014 Posts: 125 Location: US
|
|
|
|
Hi ,it runs perfectly !!! Thanks for your help!! |
|
Back to top |
|
|
|