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
 

 

REXX to take input and replace data with that data

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

New User


Joined: 30 Apr 2007
Posts: 27
Location: Hyderabad

PostPosted: Fri Jul 18, 2008 10:53 am    Post subject: REXX to take input and replace data with that data
Reply with quote

Hi,
i want to write a REXX so that i can take in put date from user and srchfor the perticular string and replace that string with the input data.

details:
i have a filed CYCLE=PRmmddyy in many jobs
and it is same in all jobs(ie PR99999999); i want to change this by user input date

NB:so advice me a good aproach for it.
Back to top
View user's profile Send private message

Aaru

Senior Member


Joined: 03 Jul 2007
Posts: 1288
Location: Chennai, India

PostPosted: Fri Jul 18, 2008 11:11 am    Post subject: Reply to: REXX to take input and replace data with that data
Reply with quote

jitu,

Follow this approach.

1) Read the template JCL in a stem variable
2) Form a loop and queue the lines one by one checking for the "PR99999999" using POS.
3) When PR99999999 is found, find the length, use LEFT/RIGHT to find the exact position of the data and overwrite the data entered by the user.
4) Queue the line till the last line.
5) Write the lines into a new/old dataset depending on your requirement.

Loop shd be like this

JCL should be read into a stem variable B

Code:
 do j = 1 to no_of_lines
           posx = pos("99999999",B.J)
           if posx > 0 then
            do
              b.j = strip(b.j)
              len = length(b.j)
              lstr = left(b.j,posx-1)
              rstr = right(b.j,len-posx-7)
              line = lstr||userdata||rstr
              queue line
            end


Use the above code as the base and develop your REXX.
Back to top
View user's profile Send private message
jitu852

New User


Joined: 30 Apr 2007
Posts: 27
Location: Hyderabad

PostPosted: Fri Jul 18, 2008 11:48 am    Post subject:
Reply with quote

Thanks for quick and excellent reply
Back to top
View user's profile Send private message
Aaru

Senior Member


Joined: 03 Jul 2007
Posts: 1288
Location: Chennai, India

PostPosted: Fri Jul 18, 2008 12:15 pm    Post subject: Reply to: REXX to take input and replace data with that data
Reply with quote

You are welcome. Develop your REXX exec and post if you still have queries.
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8593
Location: Back in jolly old England

PostPosted: Fri Jul 18, 2008 12:56 pm    Post subject:
Reply with quote

Or you could use ISPF EDIT macro

REXX code
Code:

"ISPEXEC EDIT DATSET('"Your dataset name"') MACRO(MACROE1)"


Macro code
Code:

/* REXX */
"ISREDIT MACRO"
"ISREDIT C  'PR99999999'  'New value' ALL"
"ISREDIT END"
Back to top
View user's profile Send private message
Aaru

Senior Member


Joined: 03 Jul 2007
Posts: 1288
Location: Chennai, India

PostPosted: Fri Jul 18, 2008 2:05 pm    Post subject: Reply to: REXX to take input and replace data with that data
Reply with quote

Jitu,

Expat wrote:

Quote:
Or you could use ISPF EDIT macro


This is the best and simple approach.
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8593
Location: Back in jolly old England

PostPosted: Fri Jul 18, 2008 2:08 pm    Post subject: Re: Reply to: REXX to take input and replace data with that
Reply with quote

Aaru wrote:
Jitu,
Expat wrote:
Quote:
Or you could use ISPF EDIT macro

This is the best and simple approach.

Maybe, but I still stole a copy of your code icon_smile.gif
Back to top
View user's profile Send private message
Aaru

Senior Member


Joined: 03 Jul 2007
Posts: 1288
Location: Chennai, India

PostPosted: Fri Jul 18, 2008 2:33 pm    Post subject: Reply to: REXX to take input and replace data with that data
Reply with quote

Expat,

Quote:
Maybe, but I still stole a copy of your code


Code Re-use saves time and effort icon_biggrin.gif Thanks for letting us know a simpler solution.
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
No new posts Passing data from REXX to C programme... chong.zhou CLIST & REXX 2 Wed Jul 26, 2017 9:11 pm
No new posts Passing data from REXX to C programme... chong.zhou All Other Mainframe Topics 0 Wed Jul 26, 2017 4:55 pm
No new posts copying data without knowing location arunsoods DFSORT/ICETOOL 6 Thu Jul 20, 2017 1:03 pm
This topic is locked: you cannot edit posts or make replies. Fetching data from BAI File arunsoods JCL & VSAM 1 Wed Jul 19, 2017 4:28 pm
No new posts REXX to get the all datasets name parasmalik20 CLIST & REXX 5 Tue Jul 18, 2017 9:10 pm


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