IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Sort to include date check for mmddyy format


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   This topic is locked: you cannot edit posts or make replies.
View previous topic :: View next topic  
Author Message
Aneesh

New User


Joined: 30 Sep 2006
Posts: 60

PostPosted: Fri Oct 17, 2008 9:32 pm
Reply with quote

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
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Fri Oct 17, 2008 10:12 pm
Reply with quote

Aneesh,

use the following control cards

Code:

//SYSIN    DD *                       
  SORT FIELDS=COPY                     
  INCLUDE COND=(10,6,Y2W,GT,Y'DATE1'-7)
Back to top
View user's profile Send private message
Craq Giegerich

Senior Member


Joined: 19 May 2007
Posts: 1512
Location: Virginia, USA

PostPosted: Sat Oct 18, 2008 12:15 am
Reply with quote

My first suggestion would be exec the designer.
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Sat Oct 18, 2008 12:54 am
Reply with quote

??????? Could you be a little more cryptic.
Back to top
View user's profile Send private message
Aneesh

New User


Joined: 30 Sep 2006
Posts: 60

PostPosted: Sat Oct 18, 2008 2:25 am
Reply with quote

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
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Sat Oct 18, 2008 2:39 am
Reply with quote

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
View user's profile Send private message
Aneesh

New User


Joined: 30 Sep 2006
Posts: 60

PostPosted: Sat Oct 18, 2008 2:58 am
Reply with quote

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
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Sat Oct 18, 2008 3:15 am
Reply with quote

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
View user's profile Send private message
eytellene

New User


Joined: 19 May 2009
Posts: 16
Location: Philippines

PostPosted: Mon May 25, 2009 11:51 am
Reply with quote

hi

what if I want to extract the previous months details, would that be possible to?

thanks icon_smile.gif
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Tue May 26, 2009 8:42 pm
Reply with quote

eytellene wrote:
hi

what if I want to extract the previous months details, would that be possible to?

thanks icon_smile.gif


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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   This topic is locked: you cannot edit posts or make replies. View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Populate last day of the Month in MMD... SYNCSORT 2
No new posts INCLUDE OMIT COND for Multiple values... DFSORT/ICETOOL 5
No new posts Modifying Date Format Using DFSORT DFSORT/ICETOOL 9
No new posts JCL sort card - get first day and las... JCL & VSAM 9
Search our Forums:

Back to Top