2 Char year - YY Conversion

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
snt_ds
Premium Member
Premium Member
Posts: 280
Joined: Wed Oct 18, 2006 11:53 am
Location: Pune, India

2 Char year - YY Conversion

Post by snt_ds »

Hi,

In PX, using the Env Variable for APT_DATE_CENTURY_BREAK_YEAR with values 2000 will ensure that all YY will be converted to 20YY or using the format %2000yy will do the same.
But if we have dates like 20-AUG-96 and 10-SEP-08 both will be converted to 20-AUG-2096 and 10-SEP-2008 , which is wrong as first one shld be 20-AUG-1996

In a server job, using ICONV & OCONV the same case worked correctly and it inserted the right century. Does DS internally makes an educated guess or how else it does this in Server?

Arg1 - 'DD MMM YY'
Used in a routine - OCONV(Iconv(Arg1, "D DMY[,A3,2]"),"D-YMD[4,2,2]")

Thanks,
NV
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

I don't quite understand what you are asking. The PX "APT_DATE_CENTURY_BREAK_YEAR" and the Server equivalent setting of the CENTURYPIVOT uvconfig parameter both work perfectly well.
snt_ds
Premium Member
Premium Member
Posts: 280
Joined: Wed Oct 18, 2006 11:53 am
Location: Pune, India

Post by snt_ds »

My question is..the dates mentioned in my previos message are translated correctly in Server where as in PX using the Env Variable, it traslates the Centruy part incorrectly..always add "20" to the YY part and makes it YYYY
e.g 96 comes 2096 and 08 becomes 2008 in PX where as in server it makes it 1996 and 2008

(For Server I did not set the variable as you mentioned...it will be using the default value..)
snt_ds
Premium Member
Premium Member
Posts: 280
Joined: Wed Oct 18, 2006 11:53 am
Location: Pune, India

Post by snt_ds »

My question is..the dates mentioned in my previos message are translated correctly in Server where as in PX using the Env Variable, it traslates the Centruy part incorrectly..always add "20" to the YY part and makes it YYYY
e.g 96 comes 2096 and 08 becomes 2008 in PX where as in server it makes it 1996 and 2008

(For Server I did not set the variable as you mentioned...it will be using the default value..)
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

If you set APT_DATE_CENTURY_BREAK_YEAR to 2000 then Year 96 correctly gets computed as 2096. If you set the break year to "1970" then 71 or 96 will get converted to 1971 and 1996 respectively.
snt_ds
Premium Member
Premium Member
Posts: 280
Joined: Wed Oct 18, 2006 11:53 am
Location: Pune, India

Post by snt_ds »

Yes you are right..If I pass the same date values in a Server job and use ICONV & OCONV functions as mentioned in my previous message, it seems to be intelligently converting 96 to 1996 and 08 to 2008.

This is precisely my question, how is it working correctly in Server?
I have not done any Env level settings in Server
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

ArndW wrote:the Server equivalent setting of the CENTURYPIVOT uvconfig parameter
-craig

"You can never have too many knives" -- Logan Nine Fingers
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

With the century break correctly set, %yy for year in the date format string should yield the desired results when you have two-digit years.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
abc123
Premium Member
Premium Member
Posts: 605
Joined: Fri Aug 25, 2006 8:24 am

Post by abc123 »

If APT_DATE_CENTURY_BREAK_YEAR is set to 2000, shouldn't 1996 be displayed as 1996 as it hasn't reached 2000 yet?
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

1996 will always be displayed as 1996.

APT_DATE_CENTURY_BREAK_YEAR is defined (in DataStage Parallel Job Advanced Developer's Guide page 6-19 for version 7.5) as "Four digit year which marks the century two-digit dates belong to. It is set to 1900 by default." That is, if you have a two-digit year, then the first two digits of APT_DATE_CENTURY_BREAK_YEAR are used to make up the four-digit year.

This is different behaviour than that of the CENTURYPIVOT (note "pivot" not "break") in the uvconfig file for server jobs.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply