Generic rename object

23730 pts.
IBM iSeries
Hi, I'm trying to work out a way of generically renaming objects (files in specific) on an iseries. I have a large number of files which have names that begin with a letter which needs to be changed and end in a number which also needs to be changed, for example :- Axxxxx01 Ayyyyy01 Azzzz01 The middle part of the name needs to stay the same, but the A and the 01 all need to be changed to B and 02. The length of the name is not consistent, some names are longer than others. Is there a quick way of acheiving this, or do I have to write something for it? It would also be nice if I could change the member name at the same time (member name is same as file name in this case) and the text on the member and file to all be the same. If I have to write something, suggestions on how best to do this will also be welcome. Thanks in advance, Martin Gilbert.

Answer Wiki

Thanks. We'll let you know when a new response is added.

Hi, Martin

Yes, you would have to write something, but it’s quite an enjoyable task. Especially if, like me, you don’t have much to do at the moment….

You can either use APIs, or the DSPOBJD command to get the list of objects. Read the list and apply your test criteria, creating the rename value for the RNMOBJ command to be executed through QCMDEXC.

For the members, use RNMM.

There is an API to change member text, or use CHGPFM / CHGLFM.

Altogether, it should take you no longer than 3 hours to write, depending on the style of lunch you just had….



Discuss This Question: 2  Replies

There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.
  • BigKat
    You could even do it all in CL using DSPOBJD and RCVF Kevin - Affiliated
    9,460 pointsBadges:
  • Gilly400
    Hi Guys, Thanks for the pointers. Was hoping there'd be a quick cheat for this using QSHELL or something, but I couldn't get it to do what I wanted. Problem with most of the commands with generic names is the generic part is always the end of the name, not the start (PDM lets you use generic names with the start and end of the name). I've put something quick and dirty together to let me do this. Uses DSPOBJD to a file in QTEMP, fills a subfile with the DSPOBJD info, lets you use subsets to select what you want to change and then uses QCMDEXC to do a RNMOBJ, RNMM, CHGPF, etc. Didn't take too long - skipped lunch.... Eventually I'll get round to writing my own replacement for PDM..... Cheers, Martin.
    23,730 pointsBadges:

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

Thanks! We'll email you when relevant content is added and updated.


Share this item with your network: