Page 1 of 1

Pick latest file with specific naming and copy to file

PostPosted: Thu Jun 13, 2013 8:48 pm
by jayeshbalan
Hi,

I am a new mf user. I need to get a way to find the file with latest created date file in the naming F6412DI.INSURE.*.DATA.TODAY where * is an arbitrary value. We need to first identify the latest created date file from the list dislpayed in 3.4 with names as F6412DI.INSURE.*.DATA.TODAY and copy it to another file. We need to entire thing in batch. Is there any way to do it?

Re: Pick latest file with specific naming and copy to file

PostPosted: Thu Jun 13, 2013 9:02 pm
by Akatsukami
Yes.






OK, enough Schadenfreude on my part. :twisted: The list of data sets can be gotten in various ways; I'd use LISTCAT. The creation date can be retrieved with the LISTDSI function. The copy can be done in various ways; again, my choice would be the SMCOPY command. The whole kit and kaboodle can be done as a Rexx script in background TSO.

Re: Pick latest file with specific naming and copy to file

PostPosted: Thu Jun 13, 2013 11:04 pm
by jayeshbalan
Are there any readily available rexx codes in SYS1.SAMPLIB say like 'SYS1.SAMPLIB(IGGCSIRX)' which would list dsn with volumes, instead we would require dsn with creation date. Would you have any sample code in rexx to do the operation?

Re: Pick latest file with specific naming and copy to file

PostPosted: Thu Jun 13, 2013 11:19 pm
by Akatsukami
jayeshbalan wrote:Are there any readily available rexx codes in SYS1.SAMPLIB say like 'SYS1.SAMPLIB(IGGCSIRX)' which would list dsn with volumes, instead we would require dsn with creation date.

I don't know of any, although one of the other senpai on this board may.
Would you have any sample code in rexx to do the operation?

I am sure that it is accidental that you seem to be asking me to provide you with free code. In any case, I am certain that someone with a skill set such as yours can take the hints in my previous post and produce a working script in a few days at most.

Re: Pick latest file with specific naming and copy to file

PostPosted: Fri Jun 14, 2013 12:19 am
by dick scherrer
Hello and welcome to the forum,

You are aware that the dataset list from 3.4 can be sorted in creation date sequence?

Re: Pick latest file with specific naming and copy to file

PostPosted: Fri Jun 14, 2013 3:15 am
by steve-myers
  1. I hope the topic starter is aware that data sets in z/OS do not have the time of day they are created as a data set attribute. How is your program going to distinguish between two data sets with a common creation date? At least in theory data set creation time can be retrieved from SMF data, but this is very complex and extremely time consuming.
  2. Data sets in a Generation Data Group provide a roughly equivalent capability, though the data set name standard is different than the topic starter proposes. When data sets are specified in a Generation Data Group, the most recently created data set can be selected in JCL; there is no need for a complex program to retrieve data set attributes. This feature is discussed in detail in MVS JCL User's Guide for your z/OS release.

Re: Pick latest file with specific naming and copy to file

PostPosted: Fri Jun 14, 2013 3:30 am
by dick scherrer
This feature is discussed in detail in MVS JCL User's Guide for your z/OS release.
Which is available via the "IBM Manuals" link at the top and bottom of the page.