Date comparsion in transformer

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
bicap
Premium Member
Premium Member
Posts: 95
Joined: Mon May 03, 2010 10:22 pm
Location: India
Contact:

Date comparsion in transformer

Post by bicap »

Hi All,
I need help in compare two date fields in datastage parallel job transformer stage

Both the start date and end date fileds are NULLABLE NO yes fields.

Example
================
start date :2015-12-20
End date :2015-09-19

I just want to know whether start is greater than End date in datastage transformer
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

So... what happens when you actually compare them? Actual dates or strings in that format should compare just fine without any kind of secret sauce added.
-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 »

What kind of comparison is required? Are they actual Date fields, or are they string 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.
karteek
Participant
Posts: 18
Joined: Tue Dec 06, 2011 8:50 am

Re: Date comparsion in transformer

Post by karteek »

if start_date and end_date datatypes are DATE then in transformer convert both date fileds to days then you can comapre both of them

take 3 stage variables
1.SvStartDate: JulianDayFromDate(lk.start_date)
2.SvEndDate: JulianDayFromDate(lk.end_date)
3. CALC: if SvStartDate > SvEndDate then 'X' Else 'Y'
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

If "start_date" and "end_date" are both DATE datatypes then no conversion is necessary in order to compare them.
Post Reply