Converting integer to date

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
seanc217
Premium Member
Premium Member
Posts: 188
Joined: Thu Sep 15, 2005 9:22 am

Converting integer to date

Post by seanc217 »

I have source data loaded into an Oracle database. The fields I want to convert are defined as number(7) which are defined in my metadata as integers. The format of the date is YYYYDDD. What is the best way of converting them to dates in DataStage?

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

Post by ray.wurlod »

In a Transformer stage explore the conversion functions and the casting functions. You can also search the forum, since this question has been addressed in the recent past.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
seanc217
Premium Member
Premium Member
Posts: 188
Joined: Thu Sep 15, 2005 9:22 am

Post by seanc217 »

Thanks for the hint on the function.
Here is my derivation. Does this look right?

if DSLink2.CIRAMST_DATE_LAST_BNOTICE =0 then setnull() else DateFromDaysSince(DSLink2.CIRAMST_DATE_LAST_BNOTICE[5,3],StringtoDate(DSLink2.CIRAMST_DATE_LAST_BNOTICE[1,4]:"-01-01"))

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

Post by ray.wurlod »

Does it do what you require? I can assert that it's syntactically correct, but can not comment on its semantics.
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