View previous topic :: View next topic
|
Author |
Message |
prarthana
New User
Joined: 12 Mar 2006 Posts: 21
|
|
|
|
Hi,
Can some1 give the oce for Rexx program to replace a string for a particular member in a PDS.
Thanks |
|
Back to top |
|
|
superk
Global Moderator
Joined: 26 Apr 2004 Posts: 4652 Location: Raleigh, NC, USA
|
|
|
|
String replacement is usually a whole lot easier to do with an editor (TSO EDIT or ISPF EDIT) rather than writing your own code. Any particular reason you want to use REXX instead?
At a high level, I think you'd want to:
find the position of the string within the current record, then overlay the replacement string at that same position. |
|
Back to top |
|
|
prarthana
New User
Joined: 12 Mar 2006 Posts: 21
|
|
|
|
Yes I agree.
But I have around 500 jobs where I will have to replace parms/procs for test with that of production parms/procs.
Do you have any other suggestions other than REXX for this?
Thanks. |
|
Back to top |
|
|
superk
Global Moderator
Joined: 26 Apr 2004 Posts: 4652 Location: Raleigh, NC, USA
|
|
|
|
Since I don't know what your data looks like, I can't answer. Let me reiterate that this is an easy task using an editor. If the string to be replaced is in a consistent position, and is being replaced with another string of the same length, then any utility such as SORT or SAS or Easytrieve or even Fileaid or File Manager or yes, REXX, can easily handle such as task.
An easy string replacement routine in REXX that doesn't care about the position of the string within the record:
Code: |
/* REXX */
E = 'THE QUICK BROWN FOX JUMPED OVER THE LAZY DOG'
STRNGPTRN = 'FOX '
STRNGREPL = 'FX '
SAY E
SAY LENGTH(E)
PARSE VAR E L (STRNGPTRN) R
IF LENGTH(E) <> LENGTH(L) THEN E = L||STRNGREPL||R
SAY E
SAY LENGTH(E)
|
|
|
Back to top |
|
|
ofer71
Global Moderator
Joined: 27 Dec 2005 Posts: 2358 Location: Israel
|
|
|
|
What wrong with the following Edit-Macro (which is written in REXX)?
Code: |
/* REXX */
ADDRESS ISREDIT "MACRO PROCESS"
ADDRESS ISREDIT "C ALL 'PROD' 'TEST' 8 11"
ADDRESS ISREDIT "END"
EXIT |
O. |
|
Back to top |
|
|
prarthana
New User
Joined: 12 Mar 2006 Posts: 21
|
|
|
|
Thanks.
I have a member in PDS (PRARTHANA.RUN.JCLS) - member1
The member has this piece of code
// JCLLIB ORDER=(MBCT.CA7.SIT001.PROCLIB,
// NBSP.NBS1S.PROCLIB,
// NBSP.NBS.SYS.PROCLIB)
now whereever I have MBCT.CA7.SIT001.PROCLIB, I have to replace this with NBSP.NBS.PROCLIB. I have around 20 other replacements similar to this one.
Does this give you an idea of what I want? |
|
Back to top |
|
|
ofer71
Global Moderator
Joined: 27 Dec 2005 Posts: 2358 Location: Israel
|
|
|
|
Have you seen my example?
O. |
|
Back to top |
|
|
prarthana
New User
Joined: 12 Mar 2006 Posts: 21
|
|
|
|
Yes
But I need to edit a particular member in a PDS.
Will that work? |
|
Back to top |
|
|
ofer71
Global Moderator
Joined: 27 Dec 2005 Posts: 2358 Location: Israel
|
|
|
|
Why not?
O. |
|
Back to top |
|
|
UmeySan
Active Member
Joined: 22 Aug 2006 Posts: 771 Location: Germany
|
|
|
|
Sorry, but why not using IPOUPDTE ??? |
|
Back to top |
|
|
|