How do I copy the newest member of a pds with jcl?

627 Views Asked by At

I have a problem which is I need to copy the latest member created in a PDS but as dar as I know the only option I have is to select the member name to copy. That PDS is updated daily with a FTP JCL, I cannot change, and so what I though of doing was to run my copy job after the FTP successfully ended. Is there any way I can do that? That is, select a member based on it's creation date? Thank you!

1

There are 1 best solutions below

1
On

I don't see a way to do this without writing some code.

IEBCOPY does not allow selection based on member creation date.

If the PDS is not prohibitively large, you could create a copy prior to the FTP, run SuperC in batch, parse the output (maybe with Rexx), then construct your IEBCOPY SELECT statement(s).

I don't believe you can rely on FTP updating the member statistics, which is why I'm suggesting the kludge above. It doesn't really get you the "newest" member, it gets you members that are different from the copy created prior to any FTP activity.

In your comment you indicate you want to copy the PDS with SORT. I don't believe that will give you what you want. IEBCOPY (or one of the ISV drop-in replacements) is what is used to copy PDSs. If you are SMS-managed you can use the LIKE parameter pointing to SYSUT1 on your SYSUT2 DD when you make your copy with IEBCOPY; that should copy the DCB characteristics so you get a dataset you can work with.

If you find you can rely on the PDS member statistics being updated by FTP then you can use the LMINIT, LMOPEN, LMMLIST, LMCLOSE ISPF services to determine your "newest" member without needing a copy of the PDS.