23,625 pts.
 Generic rename object
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.

Software/Hardware used:
ASKED: July 15, 2008  1:02 PM
UPDATED: July 17, 2008  9:27 AM

Answer Wiki:
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.... Regards, Sloopy
Last Wiki Answer Submitted:  July 16, 2008  1:50 pm  by  Sloopy   2,195 pts.
All Answer Wiki Contributors:  Sloopy   2,195 pts.
To see all answers submitted to the Answer Wiki: View Answer History.


Discuss This Question:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _


 

You could even do it all in CL using DSPOBJD and RCVF

Kevin – Affiliated

 7,185 pts.

 

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,625 pts.