Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
How to select the latest date record From VSAM file

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
rohanatl

New User


Joined: 21 Oct 2005
Posts: 22

PostPosted: Fri Dec 16, 2011 5:17 pm    Post subject: How to select the latest date record From VSAM file
Reply with quote

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
View user's profile Send private message

PeterHolland

Global Moderator


Joined: 27 Oct 2009
Posts: 2442
Location: Netherlands, Amstelveen

PostPosted: Fri Dec 16, 2011 5:23 pm    Post subject:
Reply with quote

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
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6968
Location: porcelain throne

PostPosted: Fri Dec 16, 2011 5:23 pm    Post subject:
Reply with quote

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
View user's profile Send private message
Jose Mateo

Active User


Joined: 29 Oct 2010
Posts: 111
Location: Puerto Rico

PostPosted: Fri Dec 16, 2011 7:48 pm    Post subject:
Reply with quote

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
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1703
Location: Australia

PostPosted: Sat Dec 17, 2011 3:32 am    Post subject:
Reply with quote

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Copy 4 byte of data from the last rec... arunsoods DFSORT/ICETOOL 9 Fri Oct 06, 2017 12:15 pm
No new posts Execute JCL step based on the content... sprikitik JCL & VSAM 2 Tue Oct 03, 2017 10:03 am
This topic is locked: you cannot edit posts or make replies. PS file data should be passed as symb... d_sarlie JCL & VSAM 15 Tue Oct 03, 2017 5:18 am
No new posts VSAM RLS Wait time blayek JCL & VSAM 2 Mon Oct 02, 2017 9:05 pm
No new posts Garbage on output file Hervey Martinez SYNCSORT 4 Wed Sep 27, 2017 12:50 am

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us