date Format YYYYMMDD check

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
vinodn
Charter Member
Charter Member
Posts: 93
Joined: Tue Dec 13, 2005 11:00 am

date Format YYYYMMDD check

Post by vinodn »

Hi,

We need to check the date format in the source column,

If format is YYYYMMDD then we need to send to Target else reject the record,

Ex: data:20080927 ---it is fine
data:20082708----it is wrong
data:00000000----it is wrong

Let me know how to check this format,
mystuff
Premium Member
Premium Member
Posts: 200
Joined: Wed Apr 11, 2007 2:06 pm

Post by mystuff »

I guess that would be a valid date, so you would need to have a special condition (ie. ignore 0000-00-00) apart from checking whether its a date.

As to know whether it is a date or not, there are date functions available, you could apply your own logic on them to know whether its a valid date or not.
ZDC
Premium Member
Premium Member
Posts: 15
Joined: Fri Nov 23, 2007 5:06 am

Post by ZDC »

how about this ...

If DateStr=DatetoString(StringtoDate(DateStr,"%yyyy%mm%dd"),"%yyyy%mm%dd") Then valid else invalid
Zero Degree Consulting
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Search the forums for the use of the "IsValid" function.
-craig

"You can never have too many knives" -- Logan Nine Fingers
vinodn
Charter Member
Charter Member
Posts: 93
Joined: Tue Dec 13, 2005 11:00 am

Post by vinodn »

Hi,

Thanks for response,

here i need to load the data to target if format is YYYYMMDD only, otherwise need to reject ,

Let me know how to handle
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

:? Check to see if the date is valid or not, reject it if it is not.

Which part of that do you need help with?
-craig

"You can never have too many knives" -- Logan Nine Fingers
vinodn
Charter Member
Charter Member
Posts: 93
Joined: Tue Dec 13, 2005 11:00 am

Post by vinodn »

chulett wrote::? Check to see if the date is valid or not, reject it if it is not.

Which part of that do you need help with?
Hi Chulett,

Thanks for your's response,

I need how to check the date format and reject that record,

i tried with IsValid, it is not working,
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

IsValid() is the correct route to take. What isn't working with that function?
sankar.td
Participant
Posts: 42
Joined: Fri Jul 25, 2008 3:53 am
Location: pune
Contact:

Post by sankar.td »

Hi All,


With out writing any logic in transfomer stage,we can reject the records which not matching to our date format by using sequential file itself.

If we goto "FORMAT" TAB in seqential file there we have to mention our required date format.so that it will reject the records which not matching to the our specified format.
kailas
Participant
Posts: 21
Joined: Mon Nov 17, 2008 11:49 pm
Location: bangalore

Post by kailas »

Hi sankar ,

I just tried using the date format in sequential file under [b]Type defaults [/b]option by giving a date format other then the incomin format ..

But when i run the job i saw that it make no difference and all records go to the destination file. I think it will not consider that format coz that is used only in case of Type Default cases.

plz try ur self once
Sainath.Srinivasan
Participant
Posts: 3337
Joined: Mon Jan 17, 2005 4:49 am
Location: United Kingdom

Post by Sainath.Srinivasan »

Give some example of good and bad values. Also provide the format mask you tried.
Post Reply