Page 1 of 1

Date Validation

Posted: Tue Jun 21, 2005 7:51 am
by Marley777
:) Hi!!

Is there a way to validate dates using DataStage? :?

Posted: Tue Jun 21, 2005 8:00 am
by elavenil
Hi,

You can do lot of date validations. Can you explain a bit more what validations that you would like to do.

Regards
Saravanan

Posted: Tue Jun 21, 2005 8:02 am
by ArndW
If you wish to take a date and see if it is a valid one, you have some Px conversions that will return an empty or null value when converting invalid inputs; this can be used as a type of validation. The Server variant of DataStage has two very powerful functions called ICONV/OCONV which will do this in a simpler and more efficient manner than Px and it might be worth thinking about doing this type of validation in a server type job.

What sort of validation are you intending on doing?

Posted: Tue Jun 21, 2005 8:05 am
by Marley777
If we have a date field that has a date value of 01/44/2005, how can I ask datastage to check the date and let me know if it's invalid? I'm looking for something that is similar to COBOL's 'DATE DATA.'

Posted: Tue Jun 21, 2005 8:18 am
by Marley777
You mentioned px conversions. Can you please elaborate?

If you wish to take a date and see if it is a valid one, you have some Px conversions that will return an empty or null value when converting invalid inputs; this can be used as a type of validation. The Server variant of DataStage has two very powerful functions called ICONV/OCONV which will do this in a simpler and more efficient manner than Px and it might be worth thinking about doing this type of validation in a server type job.

Posted: Tue Jun 21, 2005 8:47 am
by ArndW
The Px Conversion to use in your case would be StringToDate (page B-12 in the Parallel Job Developer's Guide). I'm away from my Px connection right now, but I think it returns an empty string or null when unsuccessful; you will have to try this on your own.

I still have more trust in the server side calls, as I know they deal with leap-years and other date iniquities quite well; but so should StringToDate.

Posted: Tue Jun 21, 2005 4:55 pm
by ray.wurlod
Check out the IsValid function. You may need to specify that your date format is different from your project's default.

Using IsValid Function

Posted: Tue Jun 21, 2005 11:51 pm
by thebird
Hi,

You can use the IsValid function for the date validation purpose. It would return 1 if valid and 0 if invalid.

The syntax would be -

IsValid("date",in.date)


Regards,
THe Bird.