Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

SORT YMMDD fields

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
ganeshcet

New User


Joined: 25 Jan 2007
Posts: 11
Location: New York

PostPosted: Thu Aug 20, 2009 11:54 am    Post subject: SORT YMMDD fields
Reply with quote

Is there any way we can sort YMMDD date field ? I have seen Y2C option for 2 bytes of year as part of Y2K. But here I have values in the file are

ymmdd
00101 - 2010 Jan 1st
00202 - 2010 Feb 2nd
90812 - 2009 august 12
91231 - 2009 dec 31st

Output should be

90812 - 2009 august 12
91231 - 2009 dec 31st
00101 - 2010 Jan 1st
00202 - 2010 Feb 2nd


Also I need to use Include conditon to select only Records of 2009 august or 2010 January

Please let me know if there are any SORT option available
Back to top
View user's profile Send private message

Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Thu Aug 20, 2009 12:21 pm    Post subject:
Reply with quote

Quote:
91231 - 2009 dec 31st

Just curious... how you will represent 2019 dec 31st ???

Is there restriction on data file has? like only from 2001 to 2010 etc..
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Thu Aug 20, 2009 7:22 pm    Post subject: Reply to: SORT YMMDD fields
Reply with quote

Hi Sambhaji,

[humor]
The support contract is only 5 years. By the time this is an issue, it will be someone else's concern icon_wink.gif
[/humor]

d
Back to top
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Thu Aug 20, 2009 7:39 pm    Post subject:
Reply with quote

dick wrote:

[humor]
The support contract is only 5 years. By the time this is an issue, it will be someone else's concern
[/humor]


After few years we might see post here like...

I have date in my database as 10812 but I don't know
whether it is 2001 august 12 or 2011 august 12. Is there any solution to find what date actually it is? icon_rolleyes.gif

That time one can probably only suggest is GUESS IT icon_neutral.gif
Back to top
View user's profile Send private message
Terry Heinze

JCL Moderator


Joined: 14 Jul 2008
Posts: 1249
Location: Richfield, MN, USA

PostPosted: Thu Aug 20, 2009 7:48 pm    Post subject:
Reply with quote

OH NO -- Y2K revisited?? icon_lol.gif
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


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

PostPosted: Thu Aug 20, 2009 9:27 pm    Post subject:
Reply with quote

ganeshcet,

What does each possible value of y represent. You showed 0 = 2010 and 9 = 2009. Does 1-8 represent 2001-2008 or something else?

Also, what is the RECFM and LRECL of your input file?
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Fri Aug 21, 2009 2:30 am    Post subject:
Reply with quote

Hello,

Quote:
OH NO -- Y2K revisited??
In lots of places it was not a visit - it came to stay. Lots of time-bombs sitting on lots of systems.

I'm still befuddled at the incredibly silly work-arounds that were implemented rather than simply changing the dates to CCYYMMDD. Of course, i was also befuddled by the ignorance/innocence that led many incompetent management groups (had to be a group so an individual manager could not be held responsible) to purchase client/server replacement applications that never had a chance. . .
Back to top
View user's profile Send private message
ganeshcet

New User


Joined: 25 Jan 2007
Posts: 11
Location: New York

PostPosted: Fri Aug 21, 2009 5:10 am    Post subject:
Reply with quote

Sorry folks. I don't have access to forum from work.

1. We store only 180 days of data.

2. Frank,
There a multiple files and some are fixed and variable. Hence the YMMDD (5 byte) can happen anywhere.

What does each possible value of y represent. You showed 0 = 2010 and 9 = 2009. Does 1-8 represent 2001-2008 or something else?

Yes. 1 represents 2001 and so on

Thanks
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


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

PostPosted: Fri Aug 21, 2009 9:05 pm    Post subject:
Reply with quote

You can use a DFSORT job like the following to do what you asked for. I assumed your ymmdd date starts in position 1, but you can change the job for other positions.

Code:

//S1    EXEC  PGM=SORT                     
//SYSOUT    DD  SYSOUT=*                   
//SORTIN DD *                             
00101 - 2010 Jan  1st                     
00202 - 2010 Feb 2nd                       
10101 - 2001 Jan 1st                       
10202 - 2001 Feb 2nd                       
20202 - 2002 Feb 2nd                       
30202 - 2003 Feb 2nd                       
40202 - 2004 Feb 2nd                       
50202 - 2005 Feb 2nd                       
60202 - 2006 Feb 2nd                       
70202 - 2007 Feb 2nd                       
80202 - 2008 Feb 2nd                       
90812 - 2009 august 12                     
91231 - 2009 dec 31st                     
//SORTOUT DD SYSOUT=*                     
//SYSIN    DD    *                         
  ALTSEQ CODE=(F0FA)                       
  SORT FIELDS=(1,1,AQ,A,2,4,CH,A)         
/*


SORTOUT will have:

Code:

10101 - 2001 Jan 1st         
10202 - 2001 Feb 2nd         
20202 - 2002 Feb 2nd         
30202 - 2003 Feb 2nd         
40202 - 2004 Feb 2nd         
50202 - 2005 Feb 2nd         
60202 - 2006 Feb 2nd         
70202 - 2007 Feb 2nd         
80202 - 2008 Feb 2nd         
90812 - 2009 august 12       
91231 - 2009 dec 31st       
00101 - 2010 Jan  1st       
00202 - 2010 Feb 2nd         


Warning: Personally, I would NOT use this encoding scheme for dates.
Back to top
View user's profile Send private message
ganeshcet

New User


Joined: 25 Jan 2007
Posts: 11
Location: New York

PostPosted: Tue Aug 25, 2009 8:24 am    Post subject:
Reply with quote

Frank ,
As I said we store 180 days of data, the Alternate code will not sort properly in 2011

00101 - 2010 jan 1st
10101 - 2011 jan 1st

Also can you tell us why encode scheme is not good ?

We have lots of INCLUDE COND which are like

(4,5,CH,GT,C'91201',AND,4,5,CH,LT,C'00101')

These will produce no output.

Can we do addition operation for INCLUDE COND value ?

(4,5,CH,GT,C'91201',AND,4,5,CH,LT,C'00101'+C'10101')

Thanks in advance
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Tue Aug 25, 2009 8:48 am    Post subject:
Reply with quote

Hello,

Quote:
Also can you tell us why encode scheme is not good ?
I believe you have just answered your question. . .
Quote:
We have lots of INCLUDE COND which are like
(4,5,CH,GT,C'91201',AND,4,5,CH,LT,C'00101')
These will produce no output.

What you have is a "mini" version of the problem that caused the intensity for y2k. During y2k the issue was the rollover of 99 to 00 (once a century).
The scheme used on your system will fail every decade. . .
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


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

PostPosted: Tue Aug 25, 2009 9:58 pm    Post subject:
Reply with quote

Quote:
Also can you tell us why encode scheme is not good ?


Because it's non-standard - only known to your site. Off the shelf products will not understand your date encoding scheme and so will not handle it normally.

For DFSORT, we added a lot of new functions to handle two-digit year dates based on a century window of 100 years - these functions are available to all customers. But there are no built-in functions for your scheme so you're on your own.

Quote:
Can we do addition operation for INCLUDE COND value ?

(4,5,CH,GT,C'91201',AND,4,5,CH,LT,C'00101'+C'10101')


I'm not sure what that is, but DFSORT certainly won't recognize it as valid syntax.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts SORT to unpack a feild shr_amar DFSORT/ICETOOL 7 Fri Jul 07, 2017 4:32 am
No new posts How to write Specific Fields from Mul... Padhu SYNCSORT 6 Thu Jul 06, 2017 10:26 am
No new posts Optimize sort inrec parse vishwakotin DFSORT/ICETOOL 6 Mon Jun 26, 2017 11:15 pm
No new posts Reduce CPU Times for Join Sort santoshn SYNCSORT 12 Sat Jun 10, 2017 1:40 pm
No new posts Db2 load job abending in SORT mistah kurtz DB2 4 Mon Jun 05, 2017 3:58 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us