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

Find string withn PDS member & replace value frm anothr


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

New User


Joined: 25 Dec 2008
Posts: 35
Location: India

PostPosted: Wed Apr 27, 2011 10:28 pm
Reply with quote

I have few PDS (one for each application), containing multiple members with directory paths in those (for FTP purpose). I need to write a job or utility, that would scan through each member in the PDS and find lines having 'cd' command. When such a line is encountered, I need to get the directory path against the cd command, check it against another file (which will have new mappings) and accordingly replace the path within the member from input. I have done some research on File-Aid but it seems like File-Aid can be used effectively only, if the changes to be done have more or less, the same format (in this case paths would be different in each member and hence length of string to be replaced would keep changing). Moreover, I didn't get any option of looking up against another input file. So I think the only other option may be to use REXX commands.

Could anyone please suggest any possible approach?
Back to top
View user's profile Send private message
Akatsukami

Global Moderator


Joined: 03 Oct 2009
Posts: 1788
Location: Bloomington, IL

PostPosted: Wed Apr 27, 2011 10:51 pm
Reply with quote

An edit macro might be a better choice than Rexx. However, as you have asked for Rexx...

Read the sorted mappings into stems. Allocate the member to be changed to, e.g., TULUT1. Read each record from TULUT1; search the record for the command (using POS to search for "CD " seems like a good bet to me). If the record needs to be changed, find the directory in the old map stem; get the corresponding new directory from the new map stem. Create an output record by concatenating the beginning and end of the record on either side of the directory. Write the record (changed to not) to a temporary data set or member. When the entire member has been read, copy the temporary over it.
Back to top
View user's profile Send private message
Pedro

Global Moderator


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

PostPosted: Thu Apr 28, 2011 2:19 am
Reply with quote

I agree an editor macro might be easier. Something like this:

1. exclude all lines
2. FIND 'cd' ALL WORD
3. CHANGE '/old1' '/new1' ALL NX
4. CHANGE '/old2' '/new2' ALL NX

and repeat #3 as needed. That is, move the old and new directories into the macro. This would be a manual cut and paste... not elegant programming, but you could be done in a few minutes.

Then run the macro for each member of each PDS.
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 Replace each space in cobol string wi... COBOL Programming 3
No new posts PARSE Syntax for not fix length word ... JCL & VSAM 7
No new posts Sortjoin and Search for a String and ... DFSORT/ICETOOL 1
No new posts Replace Multiple Field values to Othe... DFSORT/ICETOOL 12
No new posts To find whether record count are true... DFSORT/ICETOOL 6
Search our Forums:

Back to Top