Identify Invalid Dates

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
sb2212
Participant
Posts: 36
Joined: Mon Apr 28, 2008 1:22 am

Identify Invalid Dates

Post by sb2212 »

Hi,

We have a situation.

The source is a comma separated text file with data as below:

Country,dDate,ENm
US,2016-06-22,Smith
UK,2015-03-03,John
US,2016-15-10,Rose

We are trying to read the data using a sequential file. Tried 2 approaches:
Read everything as varchar and then used IsValidDate along with String to Date conversion. This gave warnings "String to Date Conversion".

Read the date field as Date and added a reject file to the sequential file. It rejected the data but gave a warning "field has import error and no default value".

The requirement is to reject the records with bad date and pass on only the clean data without warning.

Is there a way to achieve this?

Thanks.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Don't use "IsValidDate" to check the string, use "IsValid" with a data type of "Date" instead.
-craig

"You can never have too many knives" -- Logan Nine Fingers
sb2212
Participant
Posts: 36
Joined: Mon Apr 28, 2008 1:22 am

Post by sb2212 »

Thanks Chulett. It worked. Marking this as closed.
Post Reply