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?
Joined: 03 Oct 2009 Posts: 1782 Location: Bloomington, IL
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.