StringToDate unusual scenario

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
pandeesh
Premium Member
Premium Member
Posts: 1399
Joined: Sun Oct 24, 2010 5:15 am
Location: CHENNAI, TAMIL NADU

StringToDate unusual scenario

Post by pandeesh »

Hi,

One of my input file contains the date in the form of YYMMDD format.
But the value "111011" can be either 11-10-2011 or 11-10-1911.
It's still unambiguous whether i need to choose, 1911 or 2011.
Is there any inbuilt function to take automatically as the current century?
Currently, i am passing a parameter "cutoff_year . if it's 2000, that will be converted to 2011 else if it's 1900 then that will be converted to 1911.

Is there any other way to achieve this?

Thanks
pandeeswaran
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Search for CENTURYPIVOT.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
pandeesh
Premium Member
Premium Member
Posts: 1399
Joined: Sun Oct 24, 2010 5:15 am
Location: CHENNAI, TAMIL NADU

Post by pandeesh »

I have searched and found that simple if then else check for century will work.
But in my case i am receiving the past years data in file.
So, it will make some issues in the year of 2100.
For the current date century will be 21 and if any date comes like 100112 then that will be turned to "2110-01-12".
It will be better , if they give the data in yyyymmdd format in stead of yymmdd.

Thanks
pandeeswaran
srds2
Premium Member
Premium Member
Posts: 66
Joined: Tue Nov 29, 2011 6:56 pm

Post by srds2 »

I guess you can concatenate Left(CurrentDate(),'2') to YY before you convert it to YYYY
pandeesh
Premium Member
Premium Member
Posts: 1399
Joined: Sun Oct 24, 2010 5:15 am
Location: CHENNAI, TAMIL NADU

Post by pandeesh »

Yes. But I an receiving the old data .
May be last year . I have explained clearly in my previous post when it will create a problem
pandeeswaran
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

How do you know that you're receiving previous century's data? Leverage that knowledge to process your dates correctly.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
pandeesh
Premium Member
Premium Member
Posts: 1399
Joined: Sun Oct 24, 2010 5:15 am
Location: CHENNAI, TAMIL NADU

Post by pandeesh »

Thanks all! I will check..
pandeeswaran
PhilHibbs
Premium Member
Premium Member
Posts: 1044
Joined: Wed Sep 29, 2004 3:30 am
Location: Nottingham, UK
Contact:

Post by PhilHibbs »

I don't think it's a good idea to use a single system setting to drive all YY to YYYY conversions. You might be dealing with birth dates in one column and pension maturity dates in another, the former would always be in the past and the latter would more likely be in the future or the recent past, so a single system-wide pivot date is not the right solution. Each column should have its own conversion logic that is appropriate for the kind of date that is being converted, and some might even depend on other data within the record e.g. the midpoint date (the date that the result must be within +/- 50 years of) for a person's pension maturity date might be their date of birth + 60 years.
Phil Hibbs | Capgemini
Technical Consultant
Post Reply