I have a requirement like this:
I have to sort a file based on update date field in descending order. I have to write into another file records with the latest datetime.
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
It's not clear what you want to do. You mention a sortkey, but it isn't clear what that sortkey is. It isn't clear if you want to keep records with the latest datetime of all of the records, or of each set of records with a particular key.
You need to do a better job of explaining what you want to do. Show a better example of the records in your input file with multiple sets of records to be kept if that's relevant, and your expected output. Explain the "rules" for getting from input to output. Give the RECFM and LRECL of the input file. Give the starting position, length and format of all relevant fields and keys.
I am sorry Frank. In an urgency I have posted with insufficient information.
I have a file whose last 8 characters form the update date information in the format yyyymmdd. Say a file of LRECL 80 with last 8 characters
forming the date field.
Input:
I wish to sort this file based on update date and then extract the records which were updated latest (the latest may/ may not be current date - Please give solution for both - 1. If i need to extract the file based on update date=current date - how to dynamically retrieve the system date and hence extract those records? 2. If i need to extract the records updated latest which is not equal to current date, then i should sort based on update date in descending order and then extract top few records till the update date doesn't change for the consecutive record from the previous one).