Attempt to convert String value

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
adams06
Participant
Posts: 92
Joined: Sun Mar 12, 2006 3:00 pm

Attempt to convert String value

Post by adams06 »

how to convert a String value "02-JUN-04" to Timestamp
Last edited by adams06 on Wed May 03, 2006 3:46 pm, edited 1 time in total.
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

From first glance "26-APR-06" doesnt look like a timestamp to me. You need to use iconv/oconv functions to convert it to timestamp.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Code: Select all

Oconv(Iconv("26-APR-06", "DDMY"), "D-YMD[4,2,2]") : " 00:00:00"
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
adams06
Participant
Posts: 92
Joined: Sun Mar 12, 2006 3:00 pm

conversion error

Post by adams06 »

Hi Ray,

Input is coming in this format 04/26/2006 14:19:11

but i am getting error as

TABLE1..Transformer_1: At row 200, link "TO", while processing column "U_LOAD_TS"
Attempt to convert String value "26-APR-06" to Timestamp type unsuccessful

how to resolve this.

Thanks in advance.


ray.wurlod wrote:

Code: Select all

Oconv(Iconv("26-APR-06", "DDMY"), "D-YMD[4,2,2]") : " 00:00:00"
...
kcbland
Participant
Posts: 5208
Joined: Wed Jan 15, 2003 8:56 am
Location: Lutz, FL
Contact:

Post by kcbland »

What is the target stage you are using? It matters.
Kenneth Bland

Rank: Sempai
Belt: First degree black
Fight name: Captain Hook
Signature knockout: right upper cut followed by left hook
Signature submission: Crucifix combined with leg triangle
pkomalla
Premium Member
Premium Member
Posts: 44
Joined: Tue Mar 21, 2006 6:18 pm

Post by pkomalla »

You can use the following derviation in the transformer

TIMESTAMP(Iconv(date column,"D DMY[,A3,2]"))

It works....

TIMESTAMP is in DS Transforms/built-in/date
adams06
Participant
Posts: 92
Joined: Sun Mar 12, 2006 3:00 pm

error

Post by adams06 »

TIMESTAMP(Iconv(date column,"D DMY[,A3,2]"))
its returning a NULL value
pkomalla wrote:You can use the following derviation in the transformer

TIMESTAMP(Iconv(date column,"D DMY[,A3,2]"))

It works....

TIMESTAMP is in DS Transforms/built-in/date
jreddy
Premium Member
Premium Member
Posts: 202
Joined: Tue Feb 03, 2004 5:09 pm

Post by jreddy »

DateTimeStampToOraOCIWithTime(DateGenericToTimeStamp(link.inputcolumnname))


this should work with a generic input timestamp.. and when the target is a oraOCI stage
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

You changed the question. Originally you asked about DD-MMM-YY, and my answer handled that. Now you specify that there's a time component too, which necessarily changes the rules. Iconv() won't work with the date and time in one string. Try

Code: Select all

Oconv(Iconv(Field(InLink.TheCol, " ", 1, 1), "DDMY"), "D-YMD[4,2,2]") : InLink.TheCol[Col2(), 7]
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