View previous topic :: View next topic
|
Author |
Message |
Steve Coalbran
New User
Joined: 01 Feb 2007 Posts: 89 Location: Stockholm, Sweden
|
|
|
|
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 |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
If your z/OS supports it, have you looked at "regular expressions"? |
|
Back to top |
|
|
Marso
REXX Moderator
Joined: 13 Mar 2006 Posts: 1353 Location: Israel
|
|
|
|
I tried
Code: |
RENAME ABC*X%9 XYZ===== |
on members in my PDS, and it worked. |
|
Back to top |
|
|
Steve Coalbran
New User
Joined: 01 Feb 2007 Posts: 89 Location: Stockholm, Sweden
|
|
|
|
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 - 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 |
|
Back to top |
|
|
Steve Coalbran
New User
Joined: 01 Feb 2007 Posts: 89 Location: Stockholm, Sweden
|
|
|
|
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 |
|
Back to top |
|
|
Marso
REXX Moderator
Joined: 13 Mar 2006 Posts: 1353 Location: Israel
|
|
|
|
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) |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
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 |
|
|
|