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

Condense problem

Former Member
0 Likes
1,077

Hello friends,

I have to delete leading zeros and condense it and i am using the below code,

w_aubel = it_out-aubel.

w_len = ( STRLEN( w_aubel ) ).

DO w_len TIMES.

IF w_aubel+w_ctr(1) = '0'.

w_aubel+w_ctr(1) = ' '.

w_ctr = w_ctr + 1.

ELSE.

CLEAR w_aubel+w_ctr(1).

CLEAR w_ctr.

EXIT.

ENDIF.

ENDDO.

CONDENSE w_aubel.

For Eg - w_aubel = 005246,

my output should be 5246,

but i am getting 246.

I have looked into the debug mode and is a problem because of the clear statement.

Any help on this will be appericiated,

Shejal Shetty.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,019

Hi ,

Just use pack statement to delete the leading zeros.

Pack w_aubel to w_aubel.

Hope this helps.

7 REPLIES 7
Read only

Former Member
0 Likes
1,020

Hi ,

Just use pack statement to delete the leading zeros.

Pack w_aubel to w_aubel.

Hope this helps.

Read only

0 Likes
1,019

Hello Imtiaz i was doing something wrong,

The problem is solved by the way u have specifies.

Thanks again for your help.

Shejal.

Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
1,019

Get rid of all that and just to this.

w_aubel = it_out-aubel.
shift w_aubel left deleting leading '0'.
condense w_aubel no-gaps.

Regards,

Rich Heilman

Read only

0 Likes
1,019

Thanks Rich,

The problem solved.

Hello Ahmed i have tried the method i u specified but it deleates everything and the result is just a 0.

Thanks all for the quick reply,

Shejal Shetty.

Read only

Former Member
0 Likes
1,019

just try the below

WRITE w_aubel to laubel no-zero no-gap.

Shift laubel left deleting leading space.

Message was edited by: Anurag Bankley

Read only

ferry_lianto
Active Contributor
0 Likes
1,019

Hi Shejal,

Please try this.

REPLACE ALL OCCURRENCES OF '0' IN W_AUBEL WITH ' '.
CONDENSE W_AUBEL NO-GAPS.

Regards,

Ferry Lianto

Read only

Former Member
0 Likes
1,019

Hi,

write:/ aubel no-zero. <<removes leading zeroes>>

write:/ aubel+2. <<to ignore leading spaces>>

Regards,

sowjanya.