View previous topic :: View next topic
|
Author |
Message |
rohanatl
New User
Joined: 21 Oct 2005 Posts: 22
|
|
|
|
I have the following requirement.
Need to select the record with the latest date from a vsam file.
For Eg: I/p file is having the records like
Item Vendor Number Receipt Date
428 101 121225 (YYMMDD)
428 102 121223
In the above case i need to select the first record (with date 121225) since it is having the latest receipt date. Please help! |
|
Back to top |
|
|
PeterHolland
Global Moderator
Joined: 27 Oct 2009 Posts: 2481 Location: Netherlands, Amstelveen
|
|
|
|
If its a KSDS try an AIX on the receipt date. Probably you will have a lot of duplicates (maybe too much to build an aix). |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
if it is as simple as extracting the latest date for each item/vendor number,
there are many sort solutions available,
which would be easier/quicker to code and implement than a cobol module.
either way, you still need to sort the data before determining which record to keep. |
|
Back to top |
|
|
Jose Mateo
Active User
Joined: 29 Oct 2010 Posts: 121 Location: Puerto Rico
|
|
|
|
Good day to all!
I agree with dbz.., you should sort the file in descending order by date that way you will be processing the latest date first. |
|
Back to top |
|
|
gcicchet
Senior Member
Joined: 28 Jul 2006 Posts: 1702 Location: Australia
|
|
|
|
Hi,
the solutions provided are fine but I don't believe a sort is a must.
You can read and compare each record to the previous record and retain the record with the latest date.
Continue this process till the EOF and wrtite out the one with the latest date.
Gerry |
|
Back to top |
|
|
|