modify stage error

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
dsscholar
Premium Member
Premium Member
Posts: 195
Joined: Thu Oct 19, 2006 2:45 pm

modify stage error

Post by dsscholar »

Hi All,

I gave the following expression in modify stage

timestamp1 [:timestamp] = [StringToTimestamp] timestamp

old_columnname is timestamp and its a varchar field but contains timestamp value. So i am converting to timestamp datatype. Am getting the following error.

main_program: Error parsing modify adapter: Error in binding: Error in destination field selector: Expected integer, got: ":"; input:
timestamp1 [:timestamp] = [StringToTimestamp] timestamp

Please help me correcting this syntax .
priyadarshikunal
Premium Member
Premium Member
Posts: 1735
Joined: Thu Mar 01, 2007 5:44 am
Location: Troy, MI

Re: modify stage error

Post by priyadarshikunal »

dsscholar wrote:I gave the following expression in modify stage

timestamp1 [:timestamp] = [StringToTimestamp] timestamp
From what i remember the function is something like
TimestampFromString()

Modify stage doesn't take transformer functions.
Priyadarshi Kunal

Genius may have its limitations, but stupidity is not thus handicapped. :wink:
dsscholar
Premium Member
Premium Member
Posts: 195
Joined: Thu Oct 19, 2006 2:45 pm

Re: modify stage error

Post by dsscholar »

Thanks for the reply. But still getting the same error.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Similar perhaps, but not the same. As noted, the Modify stage uses different functions from the Transformer and they are all documented. Looks like what you need is timestamp_from_string().
-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 »

There are no square brackets around the new data type. These are used only to show optional syntax.

Code: Select all

timestamp1:timestamp = timestamp_from_string(timestamp_string)
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
dsscholar
Premium Member
Premium Member
Posts: 195
Joined: Thu Oct 19, 2006 2:45 pm

Post by dsscholar »

Hi ray,

Job ran successfully. But the converted column value is null. The input string is of nvarchar datatype, which i extracted as varchar with unicode from the source itself. After that i placed modify stage to change to timestamp.

Please advise to convert nvarchar to varchar and from varchar to timestamp. Because for remaining columns, i just want to pass as varchar.

Thanks in advance.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

If it's Unicode you need timestamp_from_ustring() function.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
dsscholar
Premium Member
Premium Member
Posts: 195
Joined: Thu Oct 19, 2006 2:45 pm

Post by dsscholar »

Source is sql server and the datatype is nvarchar. I use varchar with unicode in datastage source stage. But for all the columns am getting the following warning.. how to eliminate that.

nvarchar in sql server is nothing but varchar with unicode right? I would like to change to varchar. Any conversion needs to be done here.


Thanks in advance.
dsscholar
Premium Member
Premium Member
Posts: 195
Joined: Thu Oct 19, 2006 2:45 pm

Post by dsscholar »

Warning message :

src_INTERNAL_STMTS: When checking operator: When binding output interface field "timestamp" to field "timestamp": Implicit conversion from source type "ustring[max=20]"to result type "string".
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Specify Unicode VarChar(20) rather than unbounded non-Unicode VarChar in the stage that threw the error.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
dsscholar
Premium Member
Premium Member
Posts: 195
Joined: Thu Oct 19, 2006 2:45 pm

Post by dsscholar »

Hi Ray,

I gave as varchar (sqltype) and unicode(extended). Still throwing the same error.

Source is sql server : datatype of columns(nvarchar)
In datastage, i use sql server enterprise stage and am using varchar with unicode to extract data.. But getting that warning message.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

VarChar or VarChar(20)??
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
dsscholar
Premium Member
Premium Member
Posts: 195
Joined: Thu Oct 19, 2006 2:45 pm

Post by dsscholar »

you mean size 20 with varchar datatype or something as varchar(20)?
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

I mean precision 20 with data type VarChar.
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