IS VALID () Fatal error message

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
gsym
Charter Member
Charter Member
Posts: 118
Joined: Thu Feb 02, 2006 3:05 pm

IS VALID () Fatal error message

Post by gsym »

Hey,

the following code I have in transformer

if IsValid('Date', StringToDate("99991235" ,"%yyyy%mm%dd"))= 0 then setnull() else StringToDate("99991225" ,"%yyyy%mm%dd")

The result, its setting null correctly but I am getting a warning and a FATAL message. The following are the messgaes


Warning :

APT_CombinedOperatorController,0: Conversion error calling conversion routine date_from_string data may have been lost


Fatal:

Data string '**********' does not match format '%yyyy-%mm-%dd': an integer was expected to match tag %yyyy.

O/p result:

Peek_6,0: date:NULL

may i know how do u eliminate this Warning and fatal error??
priyadarshikunal
Premium Member
Premium Member
Posts: 1735
Joined: Thu Mar 01, 2007 5:44 am
Location: Troy, MI

Re: IS VALID () Fatal error message

Post by priyadarshikunal »

gsym wrote:Hey,

the following code I have in transformer

if IsValid('Date', StringToDate("99991235" ,"%yyyy%mm%dd"))= 0 then setnull() else StringToDate("99991225" ,"%yyyy%mm%dd")

The result, its setting null correctly but I am getting a warning and a FATAL message. The following are the messgaes


Warning :

APT_CombinedOperatorController,0: Conversion error calling conversion routine date_from_string data may have been lost


Fatal:

Data string '**********' does not match format '%yyyy-%mm-%dd': an integer was expected to match tag %yyyy.

O/p result:

Peek_6,0: date:NULL

may i know how do u eliminate this Warning and fatal error??
Do you have any character string in your input data.

probably ******** if its the same message in your log.

In case of character string the StringToDate() will fail.

Try validating it before passing it to the function if its 8 character long numeric.
Priyadarshi Kunal

Genius may have its limitations, but stupidity is not thus handicapped. :wink:
gsym
Charter Member
Charter Member
Posts: 118
Joined: Thu Feb 02, 2006 3:05 pm

Post by gsym »

hey ,

thanks for ur reply,

I have hard coded the value and it is 8 character.
For example:

StringToDate("99991235" ,"%yyyy%mm%dd")

I am validating the I/P value is valid date or not, if yes do conversion else setnull()
kduke
Charter Member
Charter Member
Posts: 5227
Joined: Thu May 29, 2003 9:47 am
Location: Dallas, TX
Contact:

Post by kduke »

IsValid is expecting a string not a date. Take the StringToDate out of your expression.
Mamu Kim
gsym
Charter Member
Charter Member
Posts: 118
Joined: Thu Feb 02, 2006 3:05 pm

Tried with string and still getting error

Post by gsym »

kduke wrote:IsValid is expecting a string not a date. Take the StringToDate out of your expression. ...

Did you mean to say:

if IsValid('Date', '99991235' ) = 0 then setnull() else StringToDate("99991225" ,"%yyyy%mm%dd")

if yes, I am still getting fatal error as

Data string '99991235' does not match format '%yyyy-%mm-%dd': an integer was expected to match tag %dd.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

35 is not a valid day number, this is what it's telling you.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Mike
Premium Member
Premium Member
Posts: 1021
Joined: Sun Mar 03, 2002 6:01 pm
Location: Tampa, FL

Post by Mike »

What is the default date format for your installation? The IsValid function is probably expecting the date in that format. From the error message it seems that your default format must be "%yyyy-%mm-%dd".

Does this work for you?

Code: Select all

If IsValid("date", "9999-12-35") = 0 then SetNull() else StringToDate("99991225" ,"%yyyy%mm%dd")
Mike
gsym
Charter Member
Charter Member
Posts: 118
Joined: Thu Feb 02, 2006 3:05 pm

Post by gsym »

Mike wrote:What is the default date format for your installation? The IsValid function is probably expecting the date in that format. From the error message it seems that your default format must be "%yyyy-%mm-%dd".

Does this work for you?

Code: Select all

If IsValid("date", "9999-12-35") = 0 then SetNull() else StringToDate("99991225" ,"%yyyy%mm%dd")
Mike
You were right, Actually I tried this and wanted to post back that its resolved, But found you have already posted it......

Thanks guys
Post Reply