View previous topic :: View next topic
|
Author |
Message |
Aneesh
New User
Joined: 30 Sep 2006 Posts: 60
|
|
|
|
Hi,
I have a FB file of length 80 that has a date field in positions 10-15 - the date is in the format mmddyy.
I need to extract all records with the date greater than current date - 7 days (all records in the past week).
Can this be done in a sort step?
Thanks in advance,
Aneesh. |
|
Back to top |
|
|
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
Aneesh,
use the following control cards
Code: |
//SYSIN DD *
SORT FIELDS=COPY
INCLUDE COND=(10,6,Y2W,GT,Y'DATE1'-7)
|
|
|
Back to top |
|
|
Craq Giegerich
Senior Member
Joined: 19 May 2007 Posts: 1512 Location: Virginia, USA
|
|
|
|
My first suggestion would be exec the designer. |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
??????? Could you be a little more cryptic. |
|
Back to top |
|
|
Aneesh
New User
Joined: 30 Sep 2006 Posts: 60
|
|
|
|
Thanks Kolusu - but i have one confusion. The following is from one of the sort manuals. The DATE1 constant is specified for yymmdd. The format that i have the input is mmddyy - am i looking at something wrong?
Operand Constant
DATE1, DATE1-d, DATE1+d C'yyyymmdd'
DATE1(c), DATE1(c)-d, DATE1(c)+d C'yyyycmmcdd'
DATE1P, DATE1P-d, DATE1P+d +yyyymmdd
DATE2, DATE2-m, DATE2+m C'yyyymm'
DATE2(c), DATE2(c)-m, DATE2(c)+m C'yyyycmm'
DATE2P, DATE2P-m, DATE2P+m +yyyymm
DATE3, DATE3-d, DATE3+d C'yyyyddd'
DATE3(c), DATE3(c)-d, DATE3(c)+d C'yyyycddd'
DATE3P, DATE3P-d, DATE3P+d +yyyyddd
DATE4 C'yyyy-mm-dd-hh.mm.ss'
Y'DATE1', Y'DATE1'-d, Y'DATE1'+d Y'yymmdd'
Y'DATE2', Y'DATE2'-m, Y'DATE2'+m Y'yymm'
Y'DATE3', Y'DATE3'-d, Y'DATE3'+d Y'yyddd'
Thanks,
Aneesh. |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Kolusu knows what he's doing.
Y2W is for an mmddyy date. DATE1 is for yymmdd date. But when you use Y2W vs Y'DATE1'-d, DFSORT is smart enough to handle the comparison between mmddyy and yymmdd correctly (trust me - I wrote the code).
For more information on comparisons with Y2x format, see:
publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/ICE1CA20/3.7.12.1 |
|
Back to top |
|
|
Aneesh
New User
Joined: 30 Sep 2006 Posts: 60
|
|
|
|
Thanks a lot, Frank, Kolusu. It was not an attempt to question the masters - just wanted to clear the doubt. It was a mistake from my side not reading the manual carefully enough - i apologize.
Once again, thanks.
Thanks,
Aneesh. |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Oh, that's ok. It is a rather subtle point. I didn't mean to imply that you were questioning Kolusu's understanding of the function. |
|
Back to top |
|
|
eytellene
New User
Joined: 19 May 2009 Posts: 16 Location: Philippines
|
|
|
|
hi
what if I want to extract the previous months details, would that be possible to?
thanks |
|
Back to top |
|
|
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
eytellene wrote: |
hi
what if I want to extract the previous months details, would that be possible to?
thanks |
Depends on what you meant by previous month. Show us an example of your input and desired output and we will show you a way to do it |
|
Back to top |
|
|
|