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

Passing symbolic parm values to JCL thru REXX


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

New User


Joined: 12 Nov 2007
Posts: 38
Location: Texas, USA

PostPosted: Tue Sep 23, 2008 5:20 pm
Reply with quote

Hi,
I am submitting a JCL(written in a sequential file) multiple times using REXX.
/******************* REXX *******************/
COUNT=1
ADDRESS TSO
DO UNTIL(COUNT=3)
"SUBMIT ('SYSDEV.IDXXX.REXX')"
COUNT=COUNT+1
END


In the JCL I am calling a proc and overriding parms

//PROC0010 EXEC TEST,
// GEN=(-5),

Now I want to change value of GEN for each run. Please suggest how I can do that.

Thanks,
Satish
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10888
Location: italy

PostPosted: Tue Sep 23, 2008 5:35 pm
Reply with quote

the rexx will just submit each member

You need to implement a member change script,
could be an edit macro
or a script to read the member, change the appropriate lines
writing them to a temporary dataset and submit the temporary dataset
Back to top
View user's profile Send private message
genesis786

Active User


Joined: 28 Sep 2005
Posts: 210
Location: St Katherine's Dock London

PostPosted: Tue Sep 23, 2008 5:39 pm
Reply with quote

i don't think using SUBMIT command u can pass any parameters (variables) to the JCL..

but you can try file tailoring..

1. make a skeleton jcl (with ur variables etc properly written), and keep it in your ISPSLIB

2. write your rexx code giving values to all the variables you want to be passed to your jcl

3. write your file tailoring commands

Code:

ADDRESS ISPEXEC "FTOPEN TEMP"     
ADDRESS ISPEXEC "FTINCL URSKEL"
ADDRESS ISPEXEC "FTCLOSE"         


4. then submit the jcl
Back to top
View user's profile Send private message
superk

Global Moderator


Joined: 26 Apr 2004
Posts: 4652
Location: Raleigh, NC, USA

PostPosted: Tue Sep 23, 2008 5:50 pm
Reply with quote

Or you can have the REXX code write the JCL code and then submit the JCL from the data stack rather than from a dataset.

See SUBMIT Command for more details.
Back to top
View user's profile Send private message
Satish5

New User


Joined: 12 Nov 2007
Posts: 38
Location: Texas, USA

PostPosted: Wed Sep 24, 2008 5:19 pm
Reply with quote

Hi,
Thanks for suggestions. This is first time I am writing a REXX.
I copied my JCL to a file. Now I am trying to read record one by one from file, search for string in record, if found then change that record and write it back to same file. Then close this file and in next step submit the JCL.

Code:

"ALLOC DA ('SYSDEV.IDABC.IDABCTRN.REXX') F(IODD) OLD REUSE"
"EXECIO * DISKRU INOD (STEM Y. FINIS)"                     
STR1='GEN1'               /*UR SEARCH STRING HERE*/       
STR2='GEN2'               /*UR SEARCH STRING HERE*/       
                                                           
X=0                                                       
DO LIN1 = 1 TO Y.0                                         
     PARSE UPPER VAR Y.LIN1 FREC                             
     IF INDEX(FREC,STR1) > 0 THEN                           
        DO                                                   
          PULL THE_REC                                       
          THE_RECORD="GEN1=(-7)"                             
          PUSH THE_REC                                       
          "EXECIO * DISKW INOD (STEM Y. FINIS)"             
          X = X + 1                                         
        END                                                 
     ELSE NOP                                               
END                                                       
SAY X                                                     


When I EXEC this rexx I recieve following message

EXTRANEOUS INFORMATION WAS IGNORED: OLD REUSE
1
A command entered or contained in a CLIST has invalid syntax.
***


Record in file is not replaced.
Please suggest a solution.

Thanks,
Satish
Back to top
View user's profile Send private message
superk

Global Moderator


Joined: 26 Apr 2004
Posts: 4652
Location: Raleigh, NC, USA

PostPosted: Wed Sep 24, 2008 5:50 pm
Reply with quote

What's the relationship between the two DD's "IODD" and "INOD"?

Also, POS is preferred over INDEX.
Back to top
View user's profile Send private message
Satish5

New User


Joined: 12 Nov 2007
Posts: 38
Location: Texas, USA

PostPosted: Wed Sep 24, 2008 7:52 pm
Reply with quote

I am sorry, IOND is typo. It is IODD.
Back to top
View user's profile Send private message
superk

Global Moderator


Joined: 26 Apr 2004
Posts: 4652
Location: Raleigh, NC, USA

PostPosted: Wed Sep 24, 2008 8:10 pm
Reply with quote

OK. So IODD is the ddname for the dataset. You'll use the same dataset for both read and write.

You're reading the dataset into the stem variable Y.

You're going to loop through the stem variable Y. and use POS (see my note about the preferred function) to search for the value 'GEN1' anywhere on the record. If found, you want to update the entire record to the value 'GEN1=(-7)'. You also want to keep a counter X of the number of hits found.

Then, you want to re-write the dataset with all of the updated records contained in the stem variable Y.

Is that the process?
Back to top
View user's profile Send private message
Satish5

New User


Joined: 12 Nov 2007
Posts: 38
Location: Texas, USA

PostPosted: Wed Sep 24, 2008 8:48 pm
Reply with quote

You are right Superk. I want to open the dataset, find the variable I want to change(actually it will be a complete record as the dataset contains job statements), change the variable, close the dataset. Then submit the jcl in that dataset. This will be done recursively. I do not know much about REXX, I am using the code posted on this forum.
Back to top
View user's profile Send private message
Pedro

Global Moderator


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

PostPosted: Wed Sep 24, 2008 9:15 pm
Reply with quote

The message says you have a syntax error in:
Code:

"ALLOC DA ('SYSDEV.IDABC.IDABCTRN.REXX') F(IODD) OLD REUSE"

Likely, it does not like the space after 'DA'.

And you probably need /*rexx*/ on first line.
Back to top
View user's profile Send private message
hchinnam

New User


Joined: 18 Oct 2006
Posts: 73

PostPosted: Wed Sep 24, 2008 10:05 pm
Reply with quote

Agree with Pedro.

If it doesn't work, try this

Code:


"ALLOC DDN(IODD) DSN('SYSDEV.IDABC.IDABCTRN.REXX') SHR REUSE"

Back to top
View user's profile Send private message
Satish5

New User


Joined: 12 Nov 2007
Posts: 38
Location: Texas, USA

PostPosted: Wed Oct 08, 2008 5:29 pm
Reply with quote

Thanks to all of you for help.
I have written MACROs and my REXX is doing what I wanted it to do except following problems.

1. I wrote a REXX to allocate user REXX library to SYSEXEC. Now everytime I login into TSO I have to execute "TSO EX REXX.EXEC(SETUP) EX"

2. My REXX begins as follows
/*REXX*/
LOGINID = USERID()
OUTDATA = LOGINID||".TRANOUT.TMP"
IF LISTDSI(OUTDATA) = 0 THEN
DELETE OUTDATA
SAY " "
SAY " "
SAY "ENTER SYSTEM NUMBER"
SAY " "
PULL SYSNUM
SAY " "
SAY "ENTER BRANCH LOCATION"
PULL BRANCH
SAY " "
SAY "ENTER 'FROM' GEN NUMBERS,e.g. -1,-2 ETC."
PULL GENFROM
SAY " "
SAY "ENTER 'TO' GEN NUMBERS,e.g. -1,-2 ETC."


Now when message is displayed after deleting OUTDATA file, value entered by user after SAY "ENTER SYSTEM NUMBER" is not recieved in SYSNUM.

Please suggest a solution for above problems.

Thanks
Satish
Back to top
View user's profile Send private message
Pedro

Global Moderator


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

PostPosted: Thu Oct 09, 2008 12:57 am
Reply with quote

Quote:
when message is displayed after deleting OUTDATA file...


It sounds like you are getting garbage in the data stack. See REXX Reference manual for usage of NEWSTACK and DELSTACK commands.
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 Run rexx with JCL Job CLIST & REXX 1
No new posts Run rexx in batch job CLIST & REXX 7
No new posts Does anyone know rexx for VSE CLIST & REXX 3
No new posts TSO ALLOC In REXX Needs Improvement JCL & VSAM 3
No new posts REXX/CMS How to place command console... CLIST & REXX 4
Search our Forums:

Back to Top