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

Rexx program to replace a string for a member in PDS.


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

New User


Joined: 12 Mar 2006
Posts: 21

PostPosted: Wed Aug 23, 2006 9:15 pm
Reply with quote

Hi,
Can some1 give the oce for Rexx program to replace a string for a particular member in a PDS.

Thanks
Back to top
View user's profile Send private message
superk

Global Moderator


Joined: 26 Apr 2004
Posts: 4652
Location: Raleigh, NC, USA

PostPosted: Wed Aug 23, 2006 9:29 pm
Reply with quote

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
View user's profile Send private message
prarthana

New User


Joined: 12 Mar 2006
Posts: 21

PostPosted: Wed Aug 23, 2006 10:35 pm
Reply with quote

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
View user's profile Send private message
superk

Global Moderator


Joined: 26 Apr 2004
Posts: 4652
Location: Raleigh, NC, USA

PostPosted: Wed Aug 23, 2006 11:14 pm
Reply with quote

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
View user's profile Send private message
ofer71

Global Moderator


Joined: 27 Dec 2005
Posts: 2358
Location: Israel

PostPosted: Wed Aug 23, 2006 11:54 pm
Reply with quote

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
View user's profile Send private message
prarthana

New User


Joined: 12 Mar 2006
Posts: 21

PostPosted: Thu Aug 24, 2006 8:40 pm
Reply with quote

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
View user's profile Send private message
ofer71

Global Moderator


Joined: 27 Dec 2005
Posts: 2358
Location: Israel

PostPosted: Thu Aug 24, 2006 11:54 pm
Reply with quote

Have you seen my example?

O.
Back to top
View user's profile Send private message
prarthana

New User


Joined: 12 Mar 2006
Posts: 21

PostPosted: Fri Aug 25, 2006 1:50 am
Reply with quote

Yes
But I need to edit a particular member in a PDS.
Will that work?
Back to top
View user's profile Send private message
ofer71

Global Moderator


Joined: 27 Dec 2005
Posts: 2358
Location: Israel

PostPosted: Fri Aug 25, 2006 1:53 pm
Reply with quote

Why not?

O.
Back to top
View user's profile Send private message
UmeySan

Active Member


Joined: 22 Aug 2006
Posts: 771
Location: Germany

PostPosted: Fri Aug 25, 2006 5:58 pm
Reply with quote

Sorry, but why not using IPOUPDTE ???
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 Compile Several JCL JOB Through one r... CLIST & REXX 4
No new posts Replace each space in cobol string wi... COBOL Programming 3
No new posts Using API Gateway from CICS program CICS 0
No new posts PARSE Syntax for not fix length word ... JCL & VSAM 7
No new posts Running REXX through JOB CLIST & REXX 13
Search our Forums:

Back to Top