2006 Jan 08 5:24 AM
Hi All,
I want to concatenate all the values of za, zb, zc into zd with a '-' seperating them, i want the value of zd to be 432-313-218. will the following work.
data: zd type i,
za type i,
zb type i,
zc type i.
za = 432.
zb = 313.
zc = 218.
concatenate za '-' zb '-' zc into zd.
write zd.
2006 Jan 08 7:57 AM
Hi,
You can use concatenate only for character fields. First should transfer the integer fields to characters and you can use the function.
Svetlin
Hi All,
I want to concatenate all the values of za, zb, zc into zd with a '-' seperating them, i want the value of zd to be 432-313-218. will the following work.
data: zd type i,
za type i,
zb type i,
zc type i.
za = 432.
zb = 313.
zc = 218.
concatenate za '-' zb '-' zc into zd.
write zd.
2006 Jan 08 5:48 AM
Hi,
Data: zd(15),
za(3),
zb(3),
zc(3).
za = 432.
zb = 313.
zc = 218.
concatenate za zb zc into zd separated by '-'.
write zd.
Regards
Sudheer
2006 Jan 08 7:57 AM
Hi,
You can use concatenate only for character fields. First should transfer the integer fields to characters and you can use the function.
Svetlin
2006 Jan 08 7:59 AM
thanks sudheer.
svetlin,
could u tell me how i can transfer from int to char.
2006 Jan 08 8:28 AM
See this sample code.
report ztest.
data: zd type i,
za type i,
zb type i,
zc type i.
data mystring(30).
za = 432.
zb = 313.
zc = 218.
perform string_concatenate using za.
perform string_concatenate using zb.
perform string_concatenate using zc.
write mystring.
form string_concatenate using myint.
data: lvar(16),
delim(1) value '-'.
lvar = myint.
condense lvar.
if mystring is initial.
clear delim.
endif.
concatenate mystring lvar into mystring separated by delim.
condense mystring.
endform. "string_concatenate
2006 Jan 08 9:54 AM
Hi,
Concatenate..Syntax:-
1) CONCATENATE <c1> <cn> INTO <c> [SEPARATED BY <s>].
2) CONCATENATE STR : STR2 INTO STRING.
You can directly assign an integer field to a char field.
So it becomes as a character.
Ex:-
Data: number type i,
numc(5) type c.
number = 211.
numc = number.
So numc is now a character type field and you can concatenate it to some other character field.
Thanks,
Sreekanth
Message was edited by: Sreekanth G
2006 Jan 08 4:51 PM
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |