replacing a part of unicode chinese string, with a string

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
sendmkpk
Premium Member
Premium Member
Posts: 97
Joined: Mon Apr 02, 2007 2:47 am

replacing a part of unicode chinese string, with a string

Post by sendmkpk »

hi,

the string is "注意:这张订单取代了我们之前的订单#xxxxxxxxx。 请在发票中注明新的" we have to replace xxxxxxxxx with the coressponding key column. like this

注意:这张订单取代了我们之前的订单#BKL2345001。 请在发票中注明新的|
, this key colunm value will change for each row.

currently i am using Convert('xxxxxxxxxx', Xfm_DuplicateCAAPS_IN.PORDNUMB,Xfm_DuplicateCAAPS_IN.Chinese_text)
but, the output i am getting is
注意:这张订单取代了我们之前的订单#BBBBBBBBBB。 请在发票中注明新的
instead of
注意:这张订单取代了我们之前的订单#BKL2345001。 请在发票中注明新的|
and the datatype is varchar Unicode

thnx
Last edited by sendmkpk on Fri Mar 19, 2010 3:23 am, edited 1 time in total.
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

The convert function works on a single character, not a string and won't work for you in this case. You might use this:

Code: Select all

svKeyPosition  INDEX(Xfm_DuplicateCAAPS_IN.Chinese_text,'xxxxxxxxxx')
NewString[svKeyPosition,10]=Xfm_DuplicateCAAPS_IN.PORDNUMB
sendmkpk
Premium Member
Premium Member
Posts: 97
Joined: Mon Apr 02, 2007 2:47 am

Post by sendmkpk »

ArndW wrote:The convert function works on a single character, not a string and won't work for you in this case. You might use this:

Code: Select all

svKeyPosition  INDEX(Xfm_DuplicateCAAPS_IN.Chinese_text,'xxxxxxxxxx')
NewString[svKeyPosition,10]=Xfm_DuplicateCAAPS_IN.PORDNUMB
great,

i am still did not understand what to do with index function, can anyone help me with the exact code. i will be thankful.
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

I just realized that I cut-and-pasted an incorrect line 2. The first line is a stage variable that is an integer which gives the starting position of the substring. The second line should be:

Code: Select all

IF svKeyPosition THEN Xfm_DuplicateCAAPS_IN.Chinese_text[1,svKeyPosition-1]:Xfm_DuplicateCAAPS_IN.PORDNUMB:Xfm_DuplicateCAAPS_IN.Chinese_text[svKeyPosition+10,9999] ELSE Xfm_DuplicateCAAPS_IN.Chinese_text
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Search out the parallel version of Ereplace() that was posted on DSXchange. Use this instead of Convert() which, as Arnd noted, only operates on one character.
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