‎2005 Oct 18 9:57 AM
Hi Folks,
I want to get a variable which contains '*'.
But length will decide dynamically.
Can anyone help me in this?
length = strlen (input) - 4.
do length times
concatnate length '*' into mask.
enddo.
But here i want to have '*' marks length times in mask.
Thanks in advance.
Rgds
Bhavani
‎2005 Oct 18 10:04 AM
hi,
i don't know whether i understannd your probs
data mask(100) type c.
length = strlen (input) - 4.
clear mask.
do length times
concatnate mask '*' into mask.
enddo.
cheers,
sasi
‎2005 Oct 18 10:02 AM
Try this
data test(30)
data num type i.
num = 5.
clear test(num) with '*'.
write test.
Cheers.
‎2005 Oct 18 10:04 AM
hi,
i don't know whether i understannd your probs
data mask(100) type c.
length = strlen (input) - 4.
clear mask.
do length times
concatnate mask '*' into mask.
enddo.
cheers,
sasi
‎2005 Oct 18 10:15 AM
Hi Sasi,
I tried the same, but not working.
By end of stmt it is having only one '*'.
It should contain length number of times the '*'.
Thanks
Bhavani
‎2005 Oct 18 10:18 AM
Did you try this
<b>data mask(100) type c.
length = strleninput) - 4.
clear mask(length) with '*'.</b>
Check in debugging if length has correct value.
cheers.
‎2005 Oct 18 10:21 AM
hi
this should work,
check your variable length (mask)
data mask(100) type c.
data length type i value 10.
clear mask.
do length times.
concatenate mask '*' into mask.
enddo.
cheers,
sasi
‎2005 Oct 18 10:22 AM
‎2005 Oct 18 10:26 AM
Hi
try this
data mask(100) type c.
data pos type i.
length = strlen (input) - 4.
clear mask.
do length times.
write '*' to mask+pos(1).
pos = pos + 1.
enddo.
Max
‎2005 Oct 18 10:26 AM
So then the problem is with
length = strlen (input) - 4.
Check what is the value in length after this staement .
Cheers.
‎2005 Oct 18 10:26 AM
Hi,
The code given by sasi is working correctly. when you are saying that "<i>By end of stmt it is having only one ''.It should contain length number of times the ''.</i>", did you check the value of LENGTH?
Thanks,
Rajeev
‎2005 Oct 18 10:20 AM
for dynamic length use a string type variable
try this code...
data : t1 type string.
str type c.
str = '*'.
do length times. "length is your calculated variable
concatenate t1 str into t1.
enddo.
write 😕 t1.
rgds,
PJ