Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
Hello,
You need to review some other similar topics and provide the necessary information. . .
Show a bit of sample input and the output you want from that input. Mentoin the recfm and lrecl of the files. Show the data potisions within the records you want to use for selecting data. If there are any rules (other than the date selection) post these.
I have coded one sort card with INCLUDE and OMIT conditions and worked but; it was a bit lengthy;
So I wanted to know if we have any SORT Utility Function that could sort the file within the date ranges. It would be easier if we have a function like this to sort based on dates.
In my file -->each record contains the date values like "02/28/2011" from the position 20 to 29 ( with slashes).
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
Hello,
Quote:
I have coded one sort card with INCLUDE and OMIT conditions and worked but; it was a bit lengthy;
As you have not posted your "sort card", no one can offer any kind of improvement suggestion. . .
The most important part of getting help here is providing proper nformation. If you are unwilling/unable to do this, you will find your topics drag on and on - eventually being locked if they completely stall.
Quote:
It would be easier if we have a function like this to sort based on dates.
Sorry for not posting exact information you have asked me to post.
Below is the Sort job I've written and worked for the date range ( 02/28/2011 to 12/31/2011). But actually i want a generic function that could sort the given date range.
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
satyapn9,
Sorting a date in (mm/dd/ccyy) format as a character string is not going sort them date wise ascending. You need to sort on CCYY first followed by MM followed by DD.
Assuming your input lrecl is 80 and recfm=fb, the following DFSORT control cards will give you the desired results. We first overlay the date in CCYYMMDD format at the end of the every record and sort on that field. Using an include cond on OUTFIL we eliminate the unwanted records by checking the date in CCYYMMDD format.