Concatenate

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
skp
Premium Member
Premium Member
Posts: 135
Joined: Wed Dec 26, 2007 1:56 am
Location: India

Concatenate

Post by skp »

Hi all,

My input date is like this......

Hmphonenumber
212-790-2820
607-871-2144
215-563-6417
804-924-4245
213-680-5200
858-453-4100
206-622-2294
-------------

I need to get the phone number without the delimeter' -'Ex:2127902820

I am useing field function and writeing to a stage variable A,B,C
1) Field(lk_AccInfo.AI_HomePhone,'-',1,1)---->211 (A)
2)Field(lk_AccInfo.AI_HomePhone,'-',2,1)---->790 (B)
3)Field (lk_AccInfo.AI_HomePhone,'-',3,1)---->2820(C)

I am trying to concatenate (in transformer Stage) all the variables but I am getting 211 only insetad of 2117902820


Is there any other ways to implements???

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

Post by ray.wurlod »

Welcome aboard.
Your Field() functions are good. Show us how you are attempting the concatenation. What is should look like is:
1) Field(lk_AccInfo.AI_HomePhone,'-',1,1)---->211 (svA)
2) Field(lk_AccInfo.AI_HomePhone,'-',2,1)---->790 (svB)
3) Field (lk_AccInfo.AI_HomePhone,'-',3,1)---->2820 (svC)
4) svA : svB : svC -----> 2117902820 (outputcolumn)
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
skp
Premium Member
Premium Member
Posts: 135
Joined: Wed Dec 26, 2007 1:56 am
Location: India

Post by skp »

ray.wurlod wrote:Welcome aboard.
Your Field() functions are good. Show us how you are attempting the concatenation. What is should look like is:
1) Field(lk_AccInfo.AI_HomePhone,'-',1,1)---->211 (svA)
2) Field(lk_AccInfo.AI_HomePhone,'-',2,1)---->790 (svB)
3) Field (lk_AccInfo.AI_HomePhone,'-',3,1)---->2820 (svC)
4) svA : svB : svC -----> 2117902820 (outputcolumn)
Thanks ray,

I am implementing the same as specified, but getting 211 of the first Variable only.
balajisr
Charter Member
Charter Member
Posts: 785
Joined: Thu Jul 28, 2005 8:58 am

Post by balajisr »

What is your output column length? Hope it is not 3.
skp
Premium Member
Premium Member
Posts: 135
Joined: Wed Dec 26, 2007 1:56 am
Location: India

Post by skp »

balajisr wrote:What is your output column length? Hope it is not 3.
output column lenght is 25 (char)
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

Could you cut-and-paste your concatenation derivation to this thread? Most likely that is not working as you expect. Also, what datatype and length have you declared your stage variables as?
dspxlearn
Premium Member
Premium Member
Posts: 291
Joined: Sat Sep 10, 2005 1:26 am

Post by dspxlearn »

skp,

Just addition to that, in my opinion the simpler would be,

Code: Select all

Convert(lk_AccInfo.AI_HomePhone,'-','')
OR

If your phone no format will be same in future also then,

Code: Select all

lk_AccInfo.AI_HomePhone[1,3] : lk_AccInfo.AI_HomePhone[5,7] : lk_AccInfo.AI_HomePhone[9,12]
If your issue has been resolved, please post your code for other's reference.
Thanks and Regards!!
dspxlearn
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

dspxlearn wrote:...

Code: Select all

Convert(lk_AccInfo.AI_HomePhone,'-','')
...
should read

Code: Select all

Convert('-','',lk_AccInfo.AI_HomePhone)
dspxlearn
Premium Member
Premium Member
Posts: 291
Joined: Sat Sep 10, 2005 1:26 am

Post by dspxlearn »

Oh yes!!

Thanks for correcting me Ray.
Thanks and Regards!!
dspxlearn
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

...that would be ArndW :wink:
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 »

What happened that this suddenly became resolved? Most recently we had
skp wrote:I am implementing the same as specified, but getting 211 of the first Variable only.
Now the thread is marked as resolved!
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Raamc
Premium Member
Premium Member
Posts: 87
Joined: Mon Aug 20, 2007 9:08 am

Post by Raamc »

You can also remove '-' by using the TRIM Function as below.

MyStr = Trim("Telephone_Number", "-", "A")
Thanks,
Raamc
Post Reply