Date 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
shrey3a
Premium Member
Premium Member
Posts: 234
Joined: Sun Nov 21, 2004 10:41 pm

Date Conversion

Post by shrey3a »

Hi Gurus,

We have date from source in packed format the data type is
S(9) 7 COMP-3 and it will always be 7 chr long. Below is the few conversion

1060101 2006-01-01
0060101 1906-01-01
-1060101 1806-01-01

I tried every sort of onversion but somehow not able to get results.

Regards,
Aruna Gutti
Premium Member
Premium Member
Posts: 145
Joined: Fri Sep 21, 2007 9:35 am
Location: Boston

Post by Aruna Gutti »

Did you tried using combination of substring and Concatenation and arrive at your own conversion logic ?
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Except that, when there's a sign, it's eight characters long.

The year is given by something like

Code: Select all

2000+Mod(InLink.TheInteger,1000000)+Mod(Int(InLink.TheInteger/1000000),10000)
The month and day can be extracted using integer division and remainder or by substring techniques.
Then re-assemble the date as a string and, if required, convert that to a Date data type.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
epernay
Participant
Posts: 8
Joined: Wed May 07, 2008 3:41 am

Post by epernay »

there are only 3 rows?
if yes, you can try "the first numbe+19":
1+19=20
0+19=19
-1+19=18
epernay
Participant
Posts: 8
Joined: Wed May 07, 2008 3:41 am

Post by epernay »

there are only 3 rows?
if yes, you can try "the first numbe+19":
1+19=20
0+19=19
-1+19=18
G SHIVARANJANI
Participant
Posts: 137
Joined: Sun Jan 07, 2007 11:17 pm
Location: VISAKHAPATNAM

Post by G SHIVARANJANI »

hi..

It s great if you can share the resolution with us.
Post Reply