Need DS transformation function for this SQL command.

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
suneyes
Participant
Posts: 82
Joined: Mon Jul 21, 2008 8:42 am

Need DS transformation function for this SQL command.

Post by suneyes »

Hi All,
I have a requirement to implement the query

select
trim( to_number(to_date(&1,'yyyymmdd') - to_date(&2,'yyyymmdd')) )

in a column of a datastage transformer stage.

&1 and &2 are two columns in the transformenr input which are dates in "YYYYMMDD" format.



the output should column dhould contain the result of the query.

can anyone help me with some datastage functions which can be used to replace this query.??
sun
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

DataStage server internal dates are Julian; so an

Code: Select all

ICONV(In.Date1,'D4YMD[4,2,2]')-ICONV(In.Date2,'D4YMD[4,2,2]'
should give you the numeric difference in days.
suneyes
Participant
Posts: 82
Joined: Mon Jul 21, 2008 8:42 am

Post by suneyes »

Thank you very much Arndw.
Iconv worked for my requirement.
thank you very much.
sun
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Perhaps you can mark this thread as Resolved, then.
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