Posted: Wed Dec 03, 2008 1:55 pm Post subject: need to select records based on date range
Members,
I have file in which there are many records and each record has a field which has a date entry in the format of MM/DD/YY.Now the dates could be from 01/01/08 till date 12/04/08.Is there a way to filter out only records which are in the range from 01/01/08 - 07/31/08 , somewhat like between these dates only i want to select the records.Is there any function in DFSORT where we can achieve the result.I do not want to put in the INLCUDE CONDITION checking for each day from Jan 01 - Jul 31.
We can also have a leap year and record for February 29 th could also occur 02/29/08 and sometimes it could also not be a leap year , how can we do this task.
Joined: 02 Dec 2002 Posts: 1618 Topics: 31 Location: San Jose
Posted: Wed Dec 03, 2008 2:18 pm Post subject:
You can use a DFSORT job like the following to do what you asked for. I assumed your date starts in position 1 and your input file has RECFM=FB and LRECL=80, but you can change the job as needed.
_________________ Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Thanks a lot for such a quick reply.Can you help me in understanding why you have used Y2PAST=1980, what does UFF mean and you have used mask M11 with length as 6 ,i guess u are making to MMDDYY format with 6 bytes and what is Y2W.
Joined: 02 Dec 2002 Posts: 1618 Topics: 31 Location: San Jose
Posted: Wed Dec 03, 2008 3:27 pm Post subject:
Y2PAST=1980 sets the century window from 1980-2079. So two-digit years from 80 to 99 are treated as 19yy years and two-digit years from 00-79 are treated as 20yy years. If that's not appropropriate, change it (e.g. Y2PAST=2000 would give a century window from 2000-2099).
UFF,M11,LENGTH=6 uses DFSORT's unsigned free form format (UFF) to extract the digits from your mm/dd/yy values resulting in 'mmddyy' values (e.g. 12/31/07 -> 123107).
Y2W is a DFSORT format that uses the century window to operate on an 'mmddyy' date. Y'yymmdd' is a yymmdd constant that uses the century window. Using Y2W with a Y'yymmdd' constant allows you to compare an 'mmddyy' date in a record to a 'yymmdd' constant - it handles normalizing the dates to the same form. _________________ Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Joined: 02 Dec 2002 Posts: 1618 Topics: 31 Location: San Jose
Posted: Wed Dec 03, 2008 4:05 pm Post subject:
What is the RECFM and LRECL of the input file? _________________ Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum