how to check valid date ?

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
abha.kalra
Participant
Posts: 37
Joined: Fri Oct 21, 2005 4:09 am

how to check valid date ?

Post by abha.kalra »

Hi ,
I am using below format to change a incoming date to required output .
now when a date like 30-feb is coming which is invalid date below format is changing it to 2-march.

OconV(ICONV(023008,DMDY[2,2,2],D-MDY[2,2,4] to 03-02-2008

Same is happening with 31sep changed to 1st october.

ideally date like this should be rejected. Is there a any function in sever edition to do that?

Thanks,
AK
Thanks and Regards
Abha
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

That's a known, documented behaviour of those functions. Ray has posted a Server IsValid() routine that will validate dates, amongst other things. Perhaps he'll post it here, or if I can turn it up later I'll add it.
-craig

"You can never have too many knives" -- Logan Nine Fingers
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

You can find it here.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
abha.kalra
Participant
Posts: 37
Joined: Fri Oct 21, 2005 4:09 am

Post by abha.kalra »

ray.wurlod wrote:You can find it here. ...
Thank you for the information Ray. How ever when I am passing the value 023009 it still returns 0

any thoughts?
Thanks and Regards
Abha
Sreenivasulu
Premium Member
Premium Member
Posts: 892
Joined: Thu Oct 16, 2003 5:18 am

Post by Sreenivasulu »

Try this format specification in isvalid function - '(m,s)%,(d,s)%,yyyy%'. This takes care of leading zeros in month and date parts.

Hope this helps

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

Post by chulett »

This is Ray's hand-rolled function, not the PX one so I don't believe that advice would be applicable here. However, don't have access to that particular code at the moment, so can neither confirm nor deny with any authority.
-craig

"You can never have too many knives" -- Logan Nine Fingers
arunkumarmm
Participant
Posts: 246
Joined: Mon Jun 30, 2008 3:22 am
Location: New York
Contact:

Post by arunkumarmm »

You can use this to check a date. This will return null if the incoming date is not valid. And this will work for all other date formats except YYYY-MM-DD.

oconv(iconv(vDate,'d4'),'d-ymd[4,2,2]')

Try this and let us know.
Arun
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

If you have downloaded the functions you can use the Test facility to verify their efficacy and, if necessary, add debugging statements (usually DSLogInfo() functions) to diagnose how particular values are being handled.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply