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

CONCATENATE

Former Member
0 Likes
1,788

data : a(3) type c value '123'.

blank(3) type c ' '.

b (4) type c value '456'.

final type string .

concartenate a blank b into final.

While doing so.....i am expecting FINAL as : 123 456.

123 (3 spaces) 456....but it is not taking 3 blanks between the two variables.

And if i try as......Concatenate a b into final with space

It is showing the result as

123 456.(only one space in between.)....but i want 3 spaces in between.

1 ACCEPTED SOLUTION
Read only

JozsefSzikszai
Active Contributor
0 Likes
1,619

hi John,

code like:

CONCATENATE a b INTO final SEPARATED BY ' '.

i. .e. 3 spaces between the ''

data : a(3) type c value '123'.

blank(3) type c ' '.

b (4) type c value '456'.

final type string .

concartenate a blank b into final.

While doing so.....i am expecting FINAL as : 123 456.

123 (3 spaces) 456....but it is not taking 3 blanks between the two variables.

And if i try as......Concatenate a b into final with space

It is showing the result as

123 456.(only one space in between.)....but i want 3 spaces in between.

11 REPLIES 11
Read only

JozsefSzikszai
Active Contributor
0 Likes
1,620

hi John,

code like:

CONCATENATE a b INTO final SEPARATED BY ' '.

i. .e. 3 spaces between the ''

Read only

varma_narayana
Active Contributor
0 Likes
1,619

Hi John..

CONCATENATE will remove the Trailing Spaces while concatenating strings.

<b>So Try this.</b>

data : a(3) type c value '123',

blank(3) type C,

b(4) type c value '456',

final type string .

concatenate a blank b into final separated by SPACE.

WRITE: FINAL.

<b>Reward if Helpful</b>

Read only

0 Likes
1,619

CONCATENATE will remove the spaces if we use literals that are in single quotes

Single quote - '

Try using back quotes

Back Quote - `

and store 3 spaces in it. This should help, but I am not sure.

Read only

Former Member
0 Likes
1,619

data : a(3) type c value '123'.

blank1(1) type c value '@'.

blank2(1) type c value '@'.

blank3(1) type c value '@'.

b (4) type c value '456'.

final type string

concartenate a blank1 blank2 blank3 b into final.

replace all occurances of '@' with space in final.

reward points to all helpful answers

kiran.M

Read only

Former Member
0 Likes
1,619

Hi use

data : a(3) type c value '123'.

blank(3) type c ' '.

b (4) type c value '456'.

final type string

concatenate a b into final SEPARATED BY blank.

Regards

sandhya

Read only

Former Member
0 Likes
1,619

try this


data : a(3) type c value '123',
blank(3) type c value '   ', " see three spces here
b(4) type c value '456',
final type string .

concatenate  a b into final separated by blank.
write : / final.

regards

shiba dutta

Read only

Former Member
0 Likes
1,619

*try this code, it gives three blanks, have checked myself

REPORT ZTRIP_TEST.

data : a(3) type c value '123',

blank(1) type c value ' ',

b(4) type c value '456',

final type string .

concatenate a blank b into final separated by space.

write final.

Reward points if useful, get back in case of query...

Cheers!!!

Read only

former_member196280
Active Contributor
0 Likes
1,619

data : a(3) type c value '123'.

<b>**blank(3) type c ' '.</b>

b (4) type c value '456'.

final type string .

concartenate a b into final <b>separated by SPACE.</b>

Tihs will sovle your problem... --> gives output as 123 456.

Regards,

SaiRam

Read only

former_member189059
Active Contributor
0 Likes
1,619

declare blank(3) as follows

data: blank(3) type c value '   '.

note: i have not used space but Alt + 0160

to get this character, keep alt pressed, then type 0160 on the numpad, then release the alt

do it thrice for your three space characters

this is the ascii code for space

Read only

0 Likes
1,619

so much guys and noone knows the addition of the concatenate statement

you can do following:

concatenate a, '3 blanks here', b into c RESPECTING BLANKS.

Message was edited by:

Florian Kemmer

Read only

0 Likes
1,619

Hi florian,

thanx for sharing your knowledge i have written this code in version 4.7


data : a(6) type c value '123',
       b(4) type c value '456',
       final type string .

concatenate  a b into final RESPECTING blankS.
write : / final.

*concatenate a '   ' b into ifinal respecting blanks.
*write : / final.

but it is giving me the error

".", "IN BYTE MODE", "SEPARATED BY ..." or "IN CHARACTER MODE" expected

after "FINAL".

can you tell me what is the reason ?

NB : commented code also i have tried .

regards

shiba dutta