07-15-2008 10:14 AM
can anybody tell me the logic to convert ssn number
421-64-8951 to 421648951 .Plz answer urgently,points will be awarded undoubtedly.
07-15-2008 10:20 AM
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
07-15-2008 10:15 AM
use replace ..
replace all occurrences of '-' in v_ssn with ''.
condense v_ssn.
07-15-2008 10:20 AM
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
07-15-2008 10:30 AM
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