Concatenate issue

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
Anee
Participant
Posts: 6
Joined: Sun Aug 27, 2006 11:32 pm

Concatenate issue

Post by Anee »

Hi

Cud anyone tell me wats wrong with the below stmt... I've used this stmt to concatenate a " to the rec if it contains QuoteChar. but the output returned is that every stmt is appended with a 1 at the end.....

if(DSLink12.F1[1,9]= "QUOTECHAR") THEN DSLink12.F1 :'"' else DSLink12.F2..

thanx
Anee
kcbland
Participant
Posts: 5208
Joined: Wed Jan 15, 2003 8:56 am
Location: Lutz, FL
Contact:

Post by kcbland »

I can't tell but a I am assuming you are using a single quote, a double quote, and then a single quote in the statement. What your statement is doing is if the first nine characters of link column DSLink12.F1 is the text "QUOTECHAR" then append your quote to that entire link column value, otherwise return link column DSLink12.F2. So, my guess is that either your text never starts with QUOTECHAR and F2 must contain the value 1.
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
kumar_s
Charter Member
Charter Member
Posts: 5245
Joined: Thu Jun 16, 2005 11:00 pm

Post by kumar_s »

Hope you are not getting confused with the new line character seen through a special text editior.
Impossible doesn't mean 'it is not possible' actually means... 'NOBODY HAS DONE IT SO FAR'
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Does the upper case string "QUOTECHAR" ever appear in the first nine positions of F1? And what's the value of F2?
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Anee
Participant
Posts: 6
Joined: Sun Aug 27, 2006 11:32 pm

Post by Anee »

Hi

QUOTECHAR does appear in the firstnine postions of F1. and F2 value of this rec is null
Inspite of this, 1 is appended at the end to all the values

Thanx
changming
Participant
Posts: 68
Joined: Wed Oct 13, 2004 3:35 am

what is stmt?

Post by changming »

what is stmt anyway?
try to cat in this way
link.field :''':'''
Anee
Participant
Posts: 6
Joined: Sun Aug 27, 2006 11:32 pm

Post by Anee »

Hi changming

It still doesnt work. Infact i doubt the stmt u wanted me to add in the transformer stage is correct.. is it possible to concatenate the way u told???
changming
Participant
Posts: 68
Joined: Wed Oct 13, 2004 3:35 am

Post by changming »

Anee wrote:Hi changming

It still doesnt work. Infact i doubt the stmt u wanted me to add in the transformer stage is correct.. is it possible to concatenate the way u told???
sorry, I tried, that is wrong. sorry for misleading you. Check your file whether it is writen by other link.
kumar_s
Charter Member
Charter Member
Posts: 5245
Joined: Thu Jun 16, 2005 11:00 pm

Post by kumar_s »

Hi Anee, Where do you see the '1'. Is it in view data or in output flat file?
What if you concatinate with other character?
Are you trying with any stage variable?
Impossible doesn't mean 'it is not possible' actually means... 'NOBODY HAS DONE IT SO FAR'
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Re: Concatenate issue

Post by ray.wurlod »

Anee wrote:Hi

Cud anyone tell me wats wrong with the below stmt... I've used this stmt to concatenate a " to the rec if it contains QuoteChar. but the output returned is that every stmt is appended with a 1 at the end.....

if(DSLink12.F1[1,9]= "QUOTECHAR") THEN DSLink12.F1 :'"' else DSLink12.F2..

thanx
Anee
Is that the entire expression? (What does the ".." at the end signify?)

If it is the entire expression, try

Code: Select all

If (DSLink12.F1[1,9] = "QUOTECHAR") THEN DSLink12.F1 : Char(34) else  DSLink12.F2
Here I've replaced the quoted quote character with Char(34) - it would be more efficient to initialize a stage variable with Char(34) and to use the stage variable (perhaps named svDoubleQuoteChar), but it gets the idea across.

I remain curious to learn where the 1 actually occurs.
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