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: 

Converting SSN Number

Former Member
0 Kudos

can anybody tell me the logic to convert ssn number

421-64-8951 to 421648951 .Plz answer urgently,points will be awarded undoubtedly.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

hi,

DATA:

w_num(15) type c value '421-64-8951' .

CONSTANT : c_hypen type value '-'.

REPLACE ALL OCCURRENCES OF c_hypen

IN w_num WITH space.

CONDENSE w_num .

Regards,

sandeep

Edited by: Sandeep patel on Jul 15, 2008 2:52 PM

3 REPLIES 3

Former Member
0 Kudos

use replace ..

replace all occurrences of '-' in v_ssn with ''.

condense v_ssn.

Former Member
0 Kudos

hi,

DATA:

w_num(15) type c value '421-64-8951' .

CONSTANT : c_hypen type value '-'.

REPLACE ALL OCCURRENCES OF c_hypen

IN w_num WITH space.

CONDENSE w_num .

Regards,

sandeep

Edited by: Sandeep patel on Jul 15, 2008 2:52 PM

former_member387317
Active Contributor
0 Kudos

u can use REPLACE statement



DATA :  TEST1(11) type C VALUE '421-64-8951'.


REPLACE ALL OCCURRENCES OF '-' IN  TEST1 WITH ''. 

*Note : its two times single qoute at last in above statement without any space between quotes

OR

USE CONCATENATE with Offset settings...

See below code

DATA:TEST1(11) type C VALUE '421-64-8951',
TEST2(3) type c,
TEST3(2) type c,
TEST4(6) type c,
TEST5(9) TYPE C.
move test1+0(3) to test2.
move test1+4(2) to test3.
move test1+7(6) to test4.

concatenate test2 test3 test4 into test5.
write:/ test5.

Hope it will solve your problem..

Thanks & Regards

ilesh 24x7