I want to copy all members of PDS to another with edited name using JCL. I have copied all members of a PDS to another but how to edit names of members.
-
Although you may have missed an opportunity to do the rename at the time that you did the copy (assuming you used IEBCOPY), I think @NealB has your best option. IEHPROGM can do it, but how many people use that these days? You could run TSO in batch and use TSO RENAME, but it would be a bit of a sledgehammer. If there is some "pattern" to the change you want, you could "generate" all the SYSIN for IDCAMS. So, either Accept, or tell us why you don't like the answer given, please. – Bill Woodger Jun 19 '13 at 16:26
2 Answers
IDCAMS ALTER... The JCL will look something like:
//STEPX EXEC PGM=IDCAMS
//SYSPRINT DD SYSOUT=A
//SYSIN DD *
ALTER HLQ.MY.PDS(OLDNAME) NEWNAME(HLQ.MY.PDS(NEWNAME))
... for as many members as you want to rename
/*

- 16,670
- 2
- 39
- 60
-
This might actually alter in place, remember to copy the PDS first so you have two copies. – mckenzm Mar 14 '15 at 11:43
I have included 2 hyperlinks at the bottom for the utilities I'll briefly discuss.
I want to copy all members of PDS to another with edited name using JCL.
First decide if you have SAS in-house. If so then use PROC SOURCE instead of IEBPTPCH [more difficult] in order to first obtain a sequential dataset [for those of you in Rio Linda it is a flat file]. Then head on out to TSO 2 [edit] or 3.4 and edit this sequential data set using the TSO editor to manually change the names of each member as desired. If you've used IEBPTPCH realize that you must also make a few extra changes that PROC SOURCE did for you. Then save this sequential dataset noticing that each member is now all listed and you can even make wholesale changes to each member itself while you're working in the TSO editor - i.e. account number changes in all of your job cards in each member as easily as using the find/change keys because you're treating this like one long sequential file.
I have copied all members of a PDS to another but how to edit names of members.
Now use IEBUPDTE with that rebuilt sequential dataset as //SYSIN and the new output file as your new PDS using //SYSUT2 as your output! It's too easy.
Now after you've created a brand new PDS/TSO library you will notice that the stats are completely missing. WHOA. Not to panic. Head on out to TSO 3.5 and pop 'em back in and you're good to go.
Good luck.