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
 

 

Mass rename of PDS members

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

Active Member


Joined: 07 Feb 2009
Posts: 984
Location: Oostende, Belgium

PostPosted: Fri May 30, 2014 6:10 pm    Post subject: Mass rename of PDS members
Reply with quote

I needed to rename 3,228 PDS members. The member names are of the format 'TnnnAA##' and 'nnn' had to be incremented by 3. Also, they reside in PDS'es with names xxxx.Txx1xy0 (xx=00/01/02, xy=01/02/03 etc), i.e. for nnn = 001-010, the members reside in xxxx.t001010 etc. My first thought was to use the LMMREN service, but sadly, LMMLIST cannot retrieve members in reverse order, so in the end I saved the memberlists to the ISPF list dataset, massaged that a little and sorted it in reverse order, and added a bit of REXX around:

Code:
/* REXX */
call filler

do i = 1 to m.0
  o = m.i
  n = overlay(right(substr(o, 2, 3) + 3, 3, '0'), o, 2)
  l = left(right(substr(o, 2, 3) - 1, 3, '0'), 2)'1'
  l = 'T' || l || right(l + 9, 3, '0')

  "ren xxxx."l"("o") xxxx."l"("n")"
  if i // 50 = 1 then
    say time('L') '"ren xxxx.'l'('o') xxxx.'l'('n')"'
end
exit


filler:
signal go
/*
T136TP99
-  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -
T054DP25
*/

go:
p = 0
do i = sigl + 2 while left(sourceline(i), 2) \= '*/'
  p   = p + 1
  m.p = strip(sourceline(i))
end
m.0 = p
return

This worked flawlessly, but can anyone think of a more automated solution? Yes, I know that doing a LMMLIST and processing the members in reverse order is an option, but that requires the names of all PDS'es to be present, whereas now they are generated on-the fly.
Back to top
View user's profile Send private message

enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10203
Location: italy

PostPosted: Fri May 30, 2014 6:43 pm    Post subject: Reply to: Mass rename of PDS members
Reply with quote

hello Robert,
probably I missed something ...

whY the need for the reverse order ?[/quote]
Back to top
View user's profile Send private message
prino

Active Member


Joined: 07 Feb 2009
Posts: 984
Location: Oostende, Belgium

PostPosted: Fri May 30, 2014 6:46 pm    Post subject: Re: Reply to: Mass rename of PDS members
Reply with quote

enrico-sorichetti wrote:
hello Robert,
probably I missed something ...

whY the need for the reverse order ?

Because you cannot rename T123xxxx to T126xxxx before renaming T126xxxx to T129xxxx. icon_smile.gif
Back to top
View user's profile Send private message
Pandora-Box

Moderator


Joined: 07 Sep 2006
Posts: 1529
Location: Andromeda Galaxy

PostPosted: Fri May 30, 2014 6:54 pm    Post subject:
Reply with quote

I am not sure if its a wise solution but

why not

rename T123xxxx to @126xxxx and @126xxxx to T126xxxx?
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10203
Location: italy

PostPosted: Fri May 30, 2014 7:02 pm    Post subject: Reply to: Mass rename of PDS members
Reply with quote

Quote:
T123xxxx to T126xxxx before renaming T126xxxx to T129xxxx.

icon_redface.gif icon_redface.gif icon_redface.gif
crossing with Pandora suggestion ...
I did it with a double rename
Back to top
View user's profile Send private message
Pedro

Senior Member


Joined: 01 Sep 2006
Posts: 2019
Location: Silicon Valley

PostPosted: Fri May 30, 2014 9:10 pm    Post subject: Reply to: Mass rename of PDS members
Reply with quote

I do not understand that
call Filler -> signal GO -> return
thing. Why not just Call GO?
Back to top
View user's profile Send private message
prino

Active Member


Joined: 07 Feb 2009
Posts: 984
Location: Oostende, Belgium

PostPosted: Fri May 30, 2014 9:22 pm    Post subject: Re: Reply to: Mass rename of PDS members
Reply with quote

Pedro wrote:
I do not understand that
call Filler -> signal GO -> return
thing. Why not just Call GO?

Because that would require the data to be moved away from where it's actually being used.
Back to top
View user's profile Send private message
Akatsukami

Global Moderator


Joined: 03 Oct 2009
Posts: 1738
Location: Bloomington, IL

PostPosted: Fri May 30, 2014 9:23 pm    Post subject:
Reply with quote

IIRC, SIGNAL is equivalent to GO TO when used with a label or an expression that evaluates to a label.
Back to top
View user's profile Send private message
prino

Active Member


Joined: 07 Feb 2009
Posts: 984
Location: Oostende, Belgium

PostPosted: Fri May 30, 2014 9:27 pm    Post subject:
Reply with quote

Akatsukami wrote:
IIRC, SIGNAL is equivalent to GO TO when used with a label or an expression that evaluates to a label.

Have been sitting behind a screen for about ten hours now, so I may be tired, but what's the relevance of the fact that signal is for all intents and purposes equal to goto?
Back to top
View user's profile Send private message
Akatsukami

Global Moderator


Joined: 03 Oct 2009
Posts: 1738
Location: Bloomington, IL

PostPosted: Fri May 30, 2014 10:23 pm    Post subject:
Reply with quote

prino wrote:
Akatsukami wrote:
IIRC, SIGNAL is equivalent to GO TO when used with a label or an expression that evaluates to a label.

Have been sitting behind a screen for about ten hours now, so I may be tired, but what's the relevance of the fact that signal is for all intents and purposes equal to goto?

Our last posts were almost simultaneous, which obscured the fact that I was replying to Pedro's question.
Back to top
View user's profile Send private message
Pedro

Senior Member


Joined: 01 Sep 2006
Posts: 2019
Location: Silicon Valley

PostPosted: Fri May 30, 2014 11:57 pm    Post subject: Reply to: Mass rename of PDS members
Reply with quote

My question was not about SIGNAL GO. My question was why use 'CALL FILLER' when you can just use 'CALL GO' instead? I do not understand the need for an indirect call. I am assuming I can learn something from Robert.
Back to top
View user's profile Send private message
prino

Active Member


Joined: 07 Feb 2009
Posts: 984
Location: Oostende, Belgium

PostPosted: Sat May 31, 2014 12:17 am    Post subject: Re: Reply to: Mass rename of PDS members
Reply with quote

Pedro wrote:
My question was not about SIGNAL GO. My question was why use 'CALL FILLER' when you can just use 'CALL GO' instead? I do not understand the need for an indirect call. I am assuming I can learn something from Robert.

The key is in the loop after the label 'go',
Code:
do i = sigl + 2 while left(sourceline(i), 2) \= '*/'
/*     ^^^^ */

If I had used 'call filler' it would have been necessary to put the commented out list of member names directly after the call, and that makes the code far less readable, at least for me. Plus, this approach makes it (theoretically) possible to move the 'filler' routine into an externally callable routine, where using 'sigl' without the intermediate 'signal' instruction would be impossible.
Back to top
View user's profile Send private message
Pedro

Senior Member


Joined: 01 Sep 2006
Posts: 2019
Location: Silicon Valley

PostPosted: Sat May 31, 2014 6:06 am    Post subject: Reply to: Mass rename of PDS members
Reply with quote

I had to study your code a bit now that I understand what you are doing. Thanks for sharing
Back to top
View user's profile Send private message
Stefan

Active User


Joined: 12 Jan 2006
Posts: 110
Location: Germany

PostPosted: Thu Jun 05, 2014 2:35 pm    Post subject: Re: Reply to: Mass rename of PDS members
Reply with quote

prino wrote:
enrico-sorichetti wrote:
hello Robert,
probably I missed something ...

whY the need for the reverse order ?

Because you cannot rename T123xxxx to T126xxxx before renaming T126xxxx to T129xxxx. icon_smile.gif

Instead of looping through the reverse member list you might rename the members twice.
In the above mentioned example this means that you first rename T123xxxx to R126xxxx and T126xxxx to R129xxxx, and in the second run you rename R126xxxx back to T126xxxx and R129xxxx back to T129xxxx.
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 Generic rename by pattern‏ Steve Coalbran CLIST & REXX 6 Mon May 30, 2016 9:34 pm
No new posts Single step utility for compare and u... ramprakashn JCL & VSAM 5 Fri Apr 29, 2016 3:43 pm
No new posts Differences between copying members b... E.LAI TSO/ISPF 8 Wed Mar 30, 2016 12:35 pm
No new posts IEHPROGM - HOW TO RENAME A PDS ? WagnerBil IBM Tools 7 Wed Aug 12, 2015 6:08 pm


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