Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Problem with concatenation

Former Member
0 Likes
1,502

Hi All,

I have 9 fields with different different lenghts. Now when I am trying to concatinate all the fields just values are concatenated which while displaying give improper results.

Now what I want is if two fields having length of 25 and 15 respectively so on concatinating it should display result as 40 whatever the length of value is there in these fields. Lets take example: -

Text1 = 'Problem' (Char 25)

Text2 = 'Solving' (Char 15)

then result should be 'Problem Solving '

I have already tried Respecting Blanks but it is giving me error saying in character mode or in byte mode or separated by expected.

<removed_by_moderator>

Edited by: Julius Bussche on Sep 8, 2008 12:20 PM

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,341

Hi,

data:
   Text1 type c length 25 value 'Problem',
   Text2 type c length 15 value 'Solving',
   text3 type string.

 CONCATENATE text1 text2
            INTO text3 separated by space.

            write: text3.

Regards,

Sravanthi

12 REPLIES 12
Read only

Former Member
0 Likes
1,341

check...concatenate text1 text2 separated by space.

Read only

Former Member
0 Likes
1,341

Hi,

try this code-

Data:w_char(2) type c,

w_final type string,

w_text1(25) type c value 'Problem',

w_text2(15) type c value 'solved'.

Concatenate w_final w_text1 w_text2 into w_final separated by w_char.

Read only

Former Member
0 Likes
1,341

Hi Sidhhart,

This is Unicode problem.

You can use addition of IN CHARACTER MODE if all fields are of character data type.

CONCATENATE TEXT1 TEXT2 INTO TEXT3 IN CHARACTER MODE.

Read only

Former Member
0 Likes
1,341

Hi All,

Thanks for your replies but these strings get dynamic values. So you can't predict that how much length of value on that field is. Because of that I can't use any constant to fill spaces while concatinating.

Read only

0 Likes
1,341

hii

just use statement like

Concatenate w_final w_text1 w_text2 into w_final separated by space

regards

twinkal

Read only

Former Member
0 Likes
1,341

Hi,

Check the following statement

concatenate text1 text2 into w_final separated by space.

data: w_final type string.

Read only

Former Member
0 Likes
1,342

Hi,

data:
   Text1 type c length 25 value 'Problem',
   Text2 type c length 15 value 'Solving',
   text3 type string.

 CONCATENATE text1 text2
            INTO text3 separated by space.

            write: text3.

Regards,

Sravanthi

Read only

0 Likes
1,341

No Boss,

It is still displaying like 'Problem Solving' where as I am looking for

'Problem (18 spaces) Solving (8 Spaces)'

Please guide me with this.

Read only

0 Likes
1,341

Siddarth,

it is not Unicode problem and in this case you don't need to bother with concatenate, just use offset:

string = text1.

string+25 = text2.

string+x = ...

hope this helps

ec

Read only

Former Member
0 Likes
1,341

Hi Siddarth,

This is Unicode problem.

You can use addition of IN CHARACTER MODE if all fields are of character data type.

Concatinate char1 char2 into result in character mode.

Thanks,

Ravi Kanth

Read only

Former Member
0 Likes
1,341

Hi

CONCATENATE text1 text2
            INTO text3  respecting blanks.

Regards,

Sravanthi

Read only

Former Member
0 Likes
1,341

thanks for your comments