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

REXX to take input and replace data with that data


IBM Mainframe Forums -> CLIST & REXX
Post new topic   Reply to topic
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
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: 1287
Location: Chennai, India

PostPosted: Fri Jul 18, 2008 11:11 am
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
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: 1287
Location: Chennai, India

PostPosted: Fri Jul 18, 2008 12:15 pm
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: 8797
Location: Welsh Wales

PostPosted: Fri Jul 18, 2008 12:56 pm
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: 1287
Location: Chennai, India

PostPosted: Fri Jul 18, 2008 2:05 pm
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: 8797
Location: Welsh Wales

PostPosted: Fri Jul 18, 2008 2:08 pm
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: 1287
Location: Chennai, India

PostPosted: Fri Jul 18, 2008 2:33 pm
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> CLIST & REXX

 


Similar Topics
Topic Forum Replies
No new posts How to save SYSLOG as text data via P... All Other Mainframe Topics 2
No new posts TRIM everything from input, output co... DFSORT/ICETOOL 1
No new posts Compile Several JCL JOB Through one r... CLIST & REXX 4
No new posts Store the data for fixed length COBOL Programming 1
No new posts Replace each space in cobol string wi... COBOL Programming 3
Search our Forums:

Back to Top