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

Generic rename by pattern‏


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

New User


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

PostPosted: Mon May 30, 2016 9:34 pm
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

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7311
Location: Inside the Matrix

PostPosted: Tue May 31, 2016 2:58 am
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: 1348
Location: Israel

PostPosted: Tue May 31, 2016 2:35 pm
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: 89
Location: Stockholm, Sweden

PostPosted: Tue May 31, 2016 2:37 pm
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: 89
Location: Stockholm, Sweden

PostPosted: Tue May 31, 2016 2:46 pm
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: 1348
Location: Israel

PostPosted: Tue May 31, 2016 3:51 pm
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

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7311
Location: Inside the Matrix

PostPosted: Wed Jun 01, 2016 1:46 am
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> CLIST & REXX

 


Similar Topics
Topic Forum Replies
No new posts Rename dasd IBM Tools 11
No new posts Error during restore rename All Other Mainframe Topics 2
No new posts IEHPROGM - HOW TO RENAME A PDS ? IBM Tools 7
No new posts How to use REXX to rename list of VSA... CLIST & REXX 10
No new posts Issue in transfering control when Del... CICS 10
Search our Forums:

Back to Top