Input file contain date field structure s9(9) comp-3 ,length 5 .
data is +60101 , How can i sort only year and month from this data, since it is packed decimal how can i seperate this fields.
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
You can use the following DFSORT job to do what you asked for. I assumed your yy years represented 1980-2079, but you can change the Y2PAST value for other ranges (e.g. Y2PAST=2000 for 2000-2099).
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
Yes, it's picking up the xyymms value from positions 3-5. So for example, for X'000991231C' it would pick up 099123 and treat it as x9912s where x and s are ignored. The century window is applied to the yy year to determine if it's 19yy or 20yy.
Special indicators: P'0...0' is sorted before all of the dates and P'9...9' is sorted after all of the dates. Even though these are not valid dates per se, some people use them in their data to indicate low and high values of some kind.
For complete details on DFSORT's Year2000 support, see: