Date to Integer in parallel edition

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
spendem
Participant
Posts: 19
Joined: Tue Mar 14, 2006 11:08 pm
Location: Mumbai/Bangalore

Date to Integer in parallel edition

Post by spendem »

Hi All,

I want tp covert a date value to an integer values and want to make a comparison with the currentdate().

Ex: IncomingDate = 2006-05-12
CurrentDate() = 2006-05-17

Requirement is: If IncomingDate = CurrentDate() Then X Else Y
I need to use above derivation on a tarnsaformer stage.

Can anyone helpme out on how to achieve this?

I am working on Enterprise Edition and Iconv and Oconv are not supported in parallel edition.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Why do you want to convert to Integer? CurrentDate() returns a Date, and presumably your input column also is of type Date. Have you tried the expression you posted? Obviously the values generated by the expressions X and Y must be of the correct data type for your output column.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
spendem
Participant
Posts: 19
Joined: Tue Mar 14, 2006 11:08 pm
Location: Mumbai/Bangalore

Post by spendem »

Hi,
Thanks for your answer, Actually I am not populating the date column in the target I will be using the Incoming date from a feed file and need to compare it with the currentDate() of the system if both are same then I need to populate a different column based on this condition. Since date columns cannot be compared or rather they need be either a character data or numeric one for comparison. thats the reason I m looking for a conversion to Integer.

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

Post by ray.wurlod »

Of course dates can be compared! Who said they can't?
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
spendem
Participant
Posts: 19
Joined: Tue Mar 14, 2006 11:08 pm
Location: Mumbai/Bangalore

Post by spendem »

Hi,
Can we achieve this comparison 2006-05-17 = 2006-05-17 in the transformer stage?
If yes then can you please explain? since I when tried using it, the derivation was invalid.

Many Thanks,
Sandeep S Pendem
spendem
Participant
Posts: 19
Joined: Tue Mar 14, 2006 11:08 pm
Location: Mumbai/Bangalore

Post by spendem »

Hi,
Its working..... What I did is I converetd the dates to DateTostring in the stage variables
And then I used them at the derivation(Transformer Stage) as,
If AsInteger(Date1) = AsInteger(Date2) Then X Else Y.

Cheers,
Spendem
ashwin141
Participant
Posts: 95
Joined: Wed Aug 24, 2005 2:26 am
Location: London, UK

Date to Integer Conversion

Post by ashwin141 »

spendem wrote:Hi,
Its working..... What I did is I converetd the dates to DateTostring in the stage variables
And then I used them at the derivation(Transformer Stage) as,
If AsInteger(Date1) = AsInteger(Date2) Then X Else Y.

Cheers,
Spendem
Hi Spendem

But I guess there is no need to conver it to String and then do the comparison as Integer. Dates can be directly compared. Just check for the datatypes of two fields. I guess it will solve the problem.

Regards
Ashwin
Post Reply