You could do this in several job steps. As an outline:
- Trap the output from LISTDS 'input-pds-name' MEMBERS into a dataset
- manipulate the MEMBERS list with ICETOOL to produce IDCAMS REPRO and DELETE commands
- run the IDCAMS REPRO
- run the IDCAMS DELETE
Setting up ICETOOL to select and format the MEMBERS list into REPRO/DELETE commands
is, by far, the most difficult step. In fact you might need to chain a couple
of ICETOOL steps to get all straight. This could take a very long time
to figure out unless you have a lot of experience
using ICETOOL. Here
is a link to the IBM DFSORT Programming Guide
(ICETOOL is just a BATCH front end to DFSORT) to give you some idea of what you
are up against.
I suggest an alternative approach. Try writing a REXX procedure to replace the
ICETOOL step. Trapping the LISTDS output and formatting it into the
appropriate IDCAMS REPRO/DELETE commands would be a much simpler process.
REXX is available on pretty much every IBM mainframe so access should not be a problem.
Please provide a bit more detail on your dataset naming conventions if you need
more help with this. Particularly, the output PDS names. I don't need or want
exact names, just how they are constructed. For example do they looks something
like this:
- HLQ.SOMENAME.FILE001
- HLQ.SOMENAME.FILE002
- HLQ.SOMENAME.FILE003
where the first 100 members are copied into FILE001, the next 100 to FILE002
etcetera. This can make a difference in how generalized you can make
the file copy utility. Also, do you keep copying in blocks of 100 until
the input PDS is exausted or is there some stopping limit?