Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Generic rename by pattern‏

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CLIST & REXX
View previous topic :: :: View next topic  
Author Message
Steve Coalbran

New User


Joined: 01 Feb 2007
Posts: 85
Location: Stockholm, Sweden

PostPosted: Mon May 30, 2016 9:34 pm    Post subject: Generic rename by pattern‏
Reply with quote

Hi Guys
I'm in search of a generic name converter.
I'm actually wanting it for renaming members but it could be any sort of ISPF 'patterns'.
I want to convert anything matching pattern-1 to pattern-2.
Like: ABC*X%9 to XYZ*X%9
/Steve
Back to top
View user's profile Send private message

Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7223

PostPosted: Tue May 31, 2016 2:58 am    Post subject: Reply to: Generic rename by pattern‏
Reply with quote

If your z/OS supports it, have you looked at "regular expressions"?
Back to top
View user's profile Send private message
Marso

REXX Moderator


Joined: 13 Mar 2006
Posts: 1218
Location: Israel

PostPosted: Tue May 31, 2016 2:35 pm    Post subject: Reply to: Generic rename by pattern‏
Reply with quote

I tried
Code:
RENAME ABC*X%9 XYZ=====

on members in my PDS, and it worked.
Back to top
View user's profile Send private message
Steve Coalbran

New User


Joined: 01 Feb 2007
Posts: 85
Location: Stockholm, Sweden

PostPosted: Tue May 31, 2016 2:37 pm    Post subject: Re: Reply to: Generic rename by pattern‏
Reply with quote

Bill Woodger wrote:
If your z/OS supports it, have you looked at "regular expressions"?


Thanks Bill, not yet. but I must (one day!). I always found them a bit scary icon_eek.gif - plus this is a feature for use by "users" who don't visit the UNIX side of the tracks.

This was a way that was suggested on the ISPF-L forum, utilizing EDIT change-picture commands.

Code:
/*REXX(BDRGREN) - generic rename by pattern -----------------------*/
ADDRESS ISPEXEC "CONTROL ERRORS RETURN "
ADDRESS ISREDIT "MACRO NOPROCESS"
ADDRESS ISPEXEC "VGET (FNAME,FPATT,TPATT)"
"LINE_AFTER 0 = (FNAME) "
"C P'"fpatt"' P'"tpatt"' FIRST "
"(TLN) = LINE .ZCSR "
tname = WORD(tln,1)
ADDRESS ISPEXEC "VPUT (TNAME) "
"CANCEL "
EXIT /*>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>*/

and TEST-RIG to DRIVE this macro...
Code:
/*TESTIT>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>*/
CALL MSG "OFF"
CALL BPXWDYN "ALLOC RTDDN(TDD) RTDSN(TDS) NEW REUSE "
PARSE VAR tds . "." tds
ADDRESS TSO "ALLOC DD("tdd") DS("tds") NEW REUSE",
            "LRECL(16) RECFM(F) BLKSIZE(16) SPACE(1)BLOCK(16) "

SAY "change last character"
PARSE VALUE "ABCJX19 ======9 ======Y" WITH fname fpatt tpatt .
ADDRESS ISPEXEC "VPUT (FNAME,FPATT,TPATT)"
ADDRESS ISPEXEC "EDIT DATASET("tds") MACRO(BDRGREN) "
ADDRESS ISPEXEC "VGET (TNAME) "
SAY "FNAME="fname "TNAME="tname

SAY "change first character"
PARSE VALUE "YBCJX19 Y====== P======" WITH fname fpatt tpatt .
ADDRESS ISPEXEC "VPUT (FNAME,FPATT,TPATT)"
ADDRESS ISPEXEC "EDIT DATASET("tds") MACRO(BDRGREN) "
ADDRESS ISPEXEC "VGET (TNAME) "
SAY "FNAME="fname "TNAME="tname

SAY "change first character - short member name"
PARSE VALUE "YBC Y====== P======" WITH fname fpatt tpatt .
ADDRESS ISPEXEC "VPUT (FNAME,FPATT,TPATT)"
ADDRESS ISPEXEC "EDIT DATASET("tds") MACRO(BDRGREN) "
ADDRESS ISPEXEC "VGET (TNAME) "
SAY "FNAME="fname "TNAME="tname

ADDRESS TSO "DELETE" tds
EXIT /*>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>*/


But I could also use it to change a whole list of membernames which I believe will be the way I apply it.

/Steve icon_smile.gif
Back to top
View user's profile Send private message
Steve Coalbran

New User


Joined: 01 Feb 2007
Posts: 85
Location: Stockholm, Sweden

PostPosted: Tue May 31, 2016 2:46 pm    Post subject: Re: Reply to: Generic rename by pattern‏
Reply with quote

Marso wrote:
I tried
Code:
RENAME ABC*X%9 XYZ=====

on members in my PDS, and it worked.

Thanks, I can explore that too.
Where do you issue this command?
/Steve icon_smile.gif
Back to top
View user's profile Send private message
Marso

REXX Moderator


Joined: 13 Mar 2006
Posts: 1218
Location: Israel

PostPosted: Tue May 31, 2016 3:51 pm    Post subject:
Reply with quote

I tried again, this time in a tso batch job, then in a rexx program, and unfortunately it didn't work (got message IKJ56709I INVALID DATA SET NAME in both cases).
The fact that it worked in my member list is certainly due to DSC (aka IPT aka SPIFFY) icon_sad.gif
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7223

PostPosted: Wed Jun 01, 2016 1:46 am    Post subject: Reply to: Generic rename by pattern‏
Reply with quote

No, I meant z/OS as in z/OS itself.

See here, in ISPF.

You should be able to use the same C functions for your own regular-expression purposes, with a little research.


Yes, we could soon be inundated with requests to "give me a regex for this so I don't have to do it in JCL".
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CLIST & REXX All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Error during restore rename archanamuthukrishnan All Other Mainframe Topics 2 Fri Oct 14, 2016 3:30 pm
No new posts IEHPROGM - HOW TO RENAME A PDS ? WagnerBil IBM Tools 7 Wed Aug 12, 2015 6:08 pm
No new posts How to use REXX to rename list of VSA... jackzhang75 CLIST & REXX 10 Wed Jun 03, 2015 11:25 pm
No new posts Issue in transfering control when Del... thesumitk CICS 10 Wed Apr 01, 2015 6:45 pm
No new posts Can i user rexx to rename sequential ... jackzhang75 CLIST & REXX 3 Sat Nov 15, 2014 1:11 am


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us