Page 1 of 1

Date comparsion in transformer

Posted: Wed Jan 14, 2015 3:43 am
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

Posted: Wed Jan 14, 2015 8:18 am
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.

Posted: Wed Jan 14, 2015 2:32 pm
by ray.wurlod
What kind of comparison is required? Are they actual Date fields, or are they string data type?

Re: Date comparsion in transformer

Posted: Mon Jan 19, 2015 7:26 am
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'

Posted: Mon Jan 19, 2015 7:31 am
by ArndW
If "start_date" and "end_date" are both DATE datatypes then no conversion is necessary in order to compare them.