View previous topic :: View next topic
|
Author |
Message |
sandhyaragav
New User
Joined: 05 Apr 2006 Posts: 14
|
|
|
|
Hi,
I need to extract records from a file within a date range Oct 1 2006 and Dec 31 2006.
The position of the Date field is 36 position and its length is 8 chars (CCYYMMDD). I need to do it with sort.
Can anyone help me out with this.
Regards
Sandhya |
|
Back to top |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8797 Location: Welsh Wales
|
|
|
|
WHich SORT, DFSORT or SYNCSORT ?
Use the INCLUDE statement
Code: |
INCLUDE COND=(pos,len,format,operator,value)
|
|
|
Back to top |
|
|
sandhyaragav
New User
Joined: 05 Apr 2006 Posts: 14
|
|
|
|
Hi expat,
I was aware of the above mentioned format for DFSORT, but was skeptical whether the GE would work for the Date fields.
I have the solution
Code: |
INCLUDE COND=(34,8,CH,GE,C'20070224')
|
Regards
Sandhya |
|
Back to top |
|
|
sandhyaragav
New User
Joined: 05 Apr 2006 Posts: 14
|
|
|
|
Thank you for the reply Expat |
|
Back to top |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8797 Location: Welsh Wales
|
|
|
|
No problems. And thank you for posting your solution. It may help others with the same question easily find the solution they want. |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Quote: |
I need to extract records from a file within a date range Oct 1 2006 and Dec 31 2006. The position of the Date field is 36 position and its
length is 8 chars (CCYYMMDD). |
The INCLUDE statement you show does not match what you said. This DFSORT INCLUDE statement does:
Code: |
INCLUDE COND=(36,8,CH,GE,C'20061001',AND,
36,8,CH,LE,C'20061231')
|
|
|
Back to top |
|
|
sandhyaragav
New User
Joined: 05 Apr 2006 Posts: 14
|
|
|
|
Hi Frank,
What you have specified is the correct answer to my question.
The reply that I had given was for the final version of my requirement. As you already would know - requirements change sometimes.
The final requirement is :
Extract all records with date greater than or equal to 24 Feb 2007.
Date position is 34 and CCYYMMDD format.
My post above has the reply for the same.
Sorry to have mislead.
Thanks Frank for correcting.
Regards
Sandhya |
|
Back to top |
|
|
|