Date Validation

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
Marley777
Premium Member
Premium Member
Posts: 316
Joined: Tue Jan 27, 2004 3:26 pm

Date Validation

Post by Marley777 »

:) Hi!!

Is there a way to validate dates using DataStage? :?
elavenil
Premium Member
Premium Member
Posts: 467
Joined: Thu Jan 31, 2002 10:20 pm
Location: Singapore

Post 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
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post 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?
Marley777
Premium Member
Premium Member
Posts: 316
Joined: Tue Jan 27, 2004 3:26 pm

Post 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.'
Marley777
Premium Member
Premium Member
Posts: 316
Joined: Tue Jan 27, 2004 3:26 pm

Post 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.
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post 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.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Check out the IsValid function. You may need to specify that your date format is different from your project's default.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
thebird
Participant
Posts: 254
Joined: Thu Jan 06, 2005 12:11 am
Location: India
Contact:

Using IsValid Function

Post 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.
Post Reply