date format issue

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
times29
Premium Member
Premium Member
Posts: 202
Joined: Mon Sep 22, 2008 3:47 pm

date format issue

Post by times29 »

Hi,
My date is in varchar 8 format like 20010431
when i do conversion its coming as 4444-01-01 any idea what can be wrong

Note: some dates are coming good but above conversion have issue


EMP_START_DT_ORIGINAL:20010431

IF IsValid("date", to_transf.EMP_START_DT_ORIGINAL, "%yyyy%mm%dd")
THEN StringToDate(to_transf.EMP_START_DT_ORIGINAL,"%yyyy%mm%dd")
ELSE StringToDate("44440101","%yyyy%mm%dd")

EMP_START_DT_after_ORIGINAL:4444-01-01
BradMiller
Premium Member
Premium Member
Posts: 87
Joined: Mon Feb 18, 2008 3:58 pm
Location: Sacramento, CA

Post by BradMiller »

In your Else statement, you are setting the date to 4444-01-01. The input date is not valid. There are only 30 days in April. It is working as you designed it.
prasson_ibm
Premium Member
Premium Member
Posts: 536
Joined: Thu Oct 11, 2007 1:48 am
Location: Bangalore

Post by prasson_ibm »

IsValid("date", to_transf.EMP_START_DT_ORIGINAL, "%yyyy%mm%dd")=1

Put this in transformer constraint to output link and draw another link as reject from transformer and make constraint condition as "Otherwise".

If your input records are not in valid date format it will go to reject link.
Post Reply