View previous topic :: View next topic
|
Author |
Message |
pema_yozer
New User
Joined: 16 Feb 2009 Posts: 54 Location: pune
|
|
|
|
Hi Everyone,
I have a requirement where I need to pick the latest log file for one of our processing,
the log file start with the same name ending with a timestamp, is there are way for me to do a pattern search and pick only the latest file name .
below are the list of file
vpw.log.D1009.T0408
vpw.log.D1010.T0410
vpw.log.D1010.T0531
vpw.log.D1011.T0408
I would only want an output file which contains the name of the latest file
vpw.log.D1011.T0408
Cleaned up posts
Pandora-Box:Locked topic |
|
Back to top |
|
|
Garry Carroll
Senior Member
Joined: 08 May 2006 Posts: 1193 Location: Dublin, Ireland
|
|
|
|
You could pass the list of datasets through SORT (descending) and then pick the first.
Garry |
|
Back to top |
|
|
steve-myers
Active Member
Joined: 30 Nov 2013 Posts: 917 Location: The Universe
|
|
|
|
pema_yozer wrote: |
Hi Everyone,
I have a requirement where I need to pick the latest log file for one of our processing,
the log file start with the same name ending with a timestamp, is there are way for me to do a patter search and pick only the latest file name .
below are the list of file
vpw.log.D1009.T0408
vpw.log.D1010.T0410
vpw.log.D1010.T0531
vpw.log.D1011.T0408
I would only want an output file which contains the name of the latest file
vpw.log.D1011.T0408 |
Five observations.- What is a "patter search?"
- Output file? I think the topic starter means input file.
- It appears whoever designed this data set name standard only knows about Windoze or similar systems. Generation data groups, a standard feature in OS/360 and every system descended from OS/360 at least 20 years before Windoze appeared, would greatly simplify this problem and permit a JCL only solution without resorting to a "patter search."
- For at least the millionth time, the only "files" in OS/360 and its descendants are data groupings on magnetic tape between the beginning of the tape and a "file mark," or between two "file marks."
- Whoever designed these file names appears to be ignorant about Y2K issues, or simply doesn't care. If I was this person's boss I'd fire him forthwith. I grant its going to be 80 odd years before this is going to be a problem, and I'm certainly going to feeding worms long before then, but lazy fools like that is why we had the Y2K problem 20 years ago.
|
|
Back to top |
|
|
Pandora-Box
Global Moderator
Joined: 07 Sep 2006 Posts: 1592 Location: Andromeda Galaxy
|
|
|
|
Why are we not taking help of GDG rather complicating it ?? |
|
Back to top |
|
|
dneufarth
Active User
Joined: 27 Apr 2005 Posts: 418 Location: Inside the SPEW (Southwest Ohio, USA)
|
|
|
|
The Y2K point is valid relative to the naming convention if not changing to GDG.
If this is a one off task for the example, sort solutions are fine.
Otherwise, D0101.Thhmm is going to require a true, complete creation date or the 'sliding window' approach.
pema_yozer, please describe your task in greater detail based on above discussion. You will find the contributors here have many solutions when they get the overall picture. |
|
Back to top |
|
|
steve-myers
Active Member
Joined: 30 Nov 2013 Posts: 917 Location: The Universe
|
|
|
|
dneufarth wrote: |
The Y2K point is valid relative to the naming convention if not changing to GDG. ...
Otherwise, D0101.Thhmm is going to require a true, complete creation date or the 'sliding window' approach. ... |
Actually since the data set name seems to lack a year in any form, perhaps we should say a sliding month approach so this fool scheme will work properly in January! |
|
Back to top |
|
|
steve-myers
Active Member
Joined: 30 Nov 2013 Posts: 917 Location: The Universe
|
|
|
|
Pandora-Box wrote: |
Why are we not taking help of GDG rather complicating it ?? |
Pandora is correct.
Unfortunately, there is some evidence this data is reaching the real computer from a toy or baby computer. We have no knowledge about the qualifications of the topic starter, and only indirect knowledge of the qualifications of the fool that devised this scheme.
Unfortunately, since we are not in the business here of writing tutorials, the best we can do is direct them to the beginners forum at ibmmainframeforum dot com |
|
Back to top |
|
|
pema_yozer
New User
Joined: 16 Feb 2009 Posts: 54 Location: pune
|
|
|
|
steve-myers wrote: |
pema_yozer wrote: |
Hi Everyone,
I have a requirement where I need to pick the latest log file for one of our processing,
the log file start with the same name ending with a timestamp, is there are way for me to do a patter search and pick only the latest file name .
below are the list of file
vpw.log.D1009.T0408
vpw.log.D1010.T0410
vpw.log.D1010.T0531
vpw.log.D1011.T0408
I would only want an output file which contains the name of the latest file
vpw.log.D1011.T0408 |
Five observations.- What is a "patter search?"
- Output file? I think the topic starter means input file.
- It appears whoever designed this data set name standard only knows about Windoze or similar systems. Generation data groups, a standard feature in OS/360 and every system descended from OS/360 at least 20 years before Windoze appeared, would greatly simplify this problem and permit a JCL only solution without resorting to a "patter search."
- For at least the millionth time, the only "files" in OS/360 and its descendants are data groupings on magnetic tape between the beginning of the tape and a "file mark," or between two "file marks."
- Whoever designed these file names appears to be ignorant about Y2K issues, or simply doesn't care. If I was this person's boss I'd fire him forthwith. I grant its going to be 80 odd years before this is going to be a problem, and I'm certainly going to feeding worms long before then, but lazy fools like that is why we had the Y2K problem 20 years ago.
|
- pattern search, hope that calms your murderous rant,
- nope output file
- no idea who designed this system but it has been there since long before
Y2K
- No GDG since its a very old legacy system and we just want to add
reconciliation into it.
These are basically job log files, we want to pick certain details from the log and use it for recon purposes, and we need to select the latest file. |
|
Back to top |
|
|
Willy Jensen
Active Member
Joined: 01 Sep 2015 Posts: 712 Location: Denmark
|
|
|
|
You need a program to pick the datasetname and copy the data, something like the following REXX. Note that the program assumes that 'VPW.LOG' is unique to those logfiles. If not then you must scan the lst. stem for the proper datasetname.
Code: |
/* REXX */
zz=outtrap('lst.')
"listc lvl('vpw.log')"
zz=outtrap('off')
n=lst.0 -1
dsn=word(lst.n,3)
say '->' dsn
cc=bpxwdyn('alloc dd(in) da('dsn') shr')
"repro infile(in) outfile(out)" |
Run it like so, substituting the REXX name, DCB etc with your own values:
Code: |
//GO EXEC PGM=IKJEFT1B,PARM='%VPWLOGCP'
//SYSEXEC DD DISP=SHR,DSN=your.exec.lib
//SYSTSPRT DD SYSOUT=*
//SYSTSIN DD DUMMY
//OUT DD UNIT=SYSDA,DISP=(,PASS),DSN=&&D1,
// RECFM=FB,LRECL=100,BLKSIZE=0,
// SPACE=(CYL,(1,25),RLSE) |
|
|
Back to top |
|
|
|