Application Development 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: 

Zeroes in a variable

radhushankar
Participant
0 Kudos

Hi All

I have to update a field with a value of '001',i have assigned it like this.

Data: variabe(3) type c value'001'.

but when i am concatenating this field with another field these zeroe are getting deleted can any tell me how to get the leading zeros??

Thanks

1 ACCEPTED SOLUTION

former_member188685
Active Contributor
0 Kudos

if you use type n declaration then leading zeroes will be padded automatically.

Data: variabe(3) type n value'001'.

2 REPLIES 2

MarcinPciak
Active Contributor
0 Kudos

Hi,

Use N instead of C.


Data: var1(3) type n value'001',
        var2 type string,
        res_var type string.
concatenate var1 var2 into res_var.

Regards

Marcin

former_member188685
Active Contributor
0 Kudos

if you use type n declaration then leading zeroes will be padded automatically.

Data: variabe(3) type n value'001'.