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

How to concatenate variable with char type and variable with integer type?

Former Member
0 Likes
3,280

Hi,

I m trying to print a varibale after concatenate char type with integer type variable. so plz help me what is exact syntax for concatenation of two type of varibale. ie. char type and Integer type..

Mukul

8 REPLIES 8
Read only

venkat_o
Active Contributor
0 Likes
1,906

Hi,

Cancatenation is only possible for data typeswith C, N , D, T and STRING. You can not concatenate char and integer variables.

What you can do is first pass integer value into one char variable and concatenate that with another char variable.

Thanks

Venkat.O

Read only

Former Member
0 Likes
1,906

HI Mukulkumar ,

try to move that integer valu to the string. and then concatenate.

because concate works for Char and string fileds

for more press F1 on Concatenate.

Thanks

Read only

Former Member
0 Likes
1,906

For concatenation u need all variable as of type C, N, D, T .

So it would be better befor concatenation, u move the integer variable to new char variable.

Then concatenate both.

i.e

Data: var1 type i,

var2 type c.

data: var3 type c.

data: w_text(10).

var3 = var1.

concatenate var3 var2 into w_text separated by space.

Regards

Srimanta

Read only

former_member302911
Active Participant
0 Likes
1,906

Hi,

Move integer to N type variable.

Example:

Data: Int type I,

ch(10),

temp type N, <---- Increment the lenght if you have number with more than 1 position

final type string.

Move int to temp.

concatenate ch temp into final.

Angelo.

Read only

Former Member
0 Likes
1,906

Hi,

Concatenation is a string or character operation and cannot not be performed with a integer as such. The integer value can be moved to a character variable and the concatenation can be performed.

Read only

Former Member
0 Likes
1,906

HI ,

Please search SDN and read HELP documnets as well ...Press F1 on CONCATENATE ....

i hope this helps..

Thanks

Read only

Former Member
0 Likes
1,906

hi Mukul,

you can move the data from interger type to char type and then concatenate...

here is the eg....

data: data1 type i,

copydata1(10) type c,

data2(10) type c,

result type string.

Data1 = 32000.

copydata1 = data1.

data2 = 'amount'.

concatenate data2 copydata1 into result.

write:/ result.

Regards

Ashu SIngh

Read only

kesavadas_thekkillath
Active Contributor
0 Likes
1,906

check this

data:var1 type i value 25.
data:var2(3) type c.
data:output(255) type c.

write var1 to output.
concatenate output var2 into output.

write output.