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!
-
Can you please update your question with the information from your comment on @cschneid's wide-ranging answer and augment it with what you want to do (tell us what you want to do) rather then ask us how to do what you think will give you what you want. If you are FTPing a file into a PDS there are no member stats recorded. None. Zero. Nada. So kill that route, and tell us what you need to do. – Bill Woodger Dec 24 '13 at 01:23
-
The only thing you can be guaranteed to access if it's a normal PDS and has not been compressed is the last member written. PDSE, you're out of luck. Compressed, you're out of luck. – zarchasmpgmr Jan 03 '14 at 21:10
1 Answers
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.

- 10,237
- 1
- 28
- 39
-
I am trying something like copying the pds (without selecting members, to copy it all) to a temporary dataset in order, I hope, to be able to use that temp dataset as input to sort (i am also hoping it would copy the stats) and then sort in ascending order of the 'creation date' positions. I am having a problem which is the dataset is created but in a format I can read...VS. – csbl Dec 23 '13 at 18:47