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

how to separate the data ?

Former Member
0 Likes
1,066

Hi Friends,

After CONCATENATE my value is u2018p12345000u2019.

I want to separate last 3 character( 000 ).

Please guide me how to separate last 3 character from the u2018p12345000u2019.

Thanking you friends.

Subash

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,027

Hi Subash,

I feel Simple Shift if very helpful for your case...

Simple you can use the Shift command also,,,,

Example :

SHIFT ALPHA1 BY FIVE PLACES.

SHIFT ALPHA2 RIGHT BY 2 PLACES.

Just use F1 Help for Shift.

Thanks & regards,

Dileep .C

Hi Friends,

After CONCATENATE my value is u2018p12345000u2019.

I want to separate last 3 character( 000 ).

Please guide me how to separate last 3 character from the u2018p12345000u2019.

Thanking you friends.

Subash

7 REPLIES 7
Read only

Former Member
0 Likes
1,027

Hi,

Incase you know the field length then just use offset.

If you do not know the field length then first determine the field length using STRLEN and the use offset.

for eg.

var1 = p12345000

var2 = var1+5(3).

Regards,

Ankur Parab

Read only

0 Likes
1,027

Hi Ankur,

Thanking u .

But that field value is always not constant .

So how to separate always last 3 value only ?

Thanking you friends.

Subash

Read only

0 Likes
1,027

Hi,

try this way to separeate the last three values irrespective of lenght..



Data: v1 type string. 
Data: vlen type i,
         vstart type i.
 
v1 = u2018p12345000u2019.
vlen = strlen( v1 ).
vstart = vlen - 3.

w_value = v1 + vstart ( 3).   "Now the w_Value contains last three values of a string

Regards,

Prabhudas

Read only

0 Likes
1,027

Hi,

Try this,

data : a(10) type C,

b(10) type C,

c(20) type C,

d(13) type c.

a = '1234'.

b = '123abc'.

concatenate a b into c.

d = C+7(10).

write d.

it will defintely work for u.

Thanks

Read only

former_member229729
Active Participant
0 Likes
1,027

Hi Subash,

You can use the below given logic.

The value can be of any length. The below given code gives you the last 3 characters only:


Data: v1 type string. 
Data: vlen type i,
         vstart type i.

v1 = u2018p12345000u2019.
vlen = strlen( v1 ).
vstart = vlen - 3.
write: v1+vStart.

Rgds,

Ramani N

Edited by: Ramani Nagarajan on Jun 17, 2009 6:12 PM

Read only

Former Member
0 Likes
1,028

Hi Subash,

I feel Simple Shift if very helpful for your case...

Simple you can use the Shift command also,,,,

Example :

SHIFT ALPHA1 BY FIVE PLACES.

SHIFT ALPHA2 RIGHT BY 2 PLACES.

Just use F1 Help for Shift.

Thanks & regards,

Dileep .C

Read only

0 Likes
1,027

Hi Dileep Kumar ,

Thank you for your best answer.

Thanking all of U.

Warm regards,

Subash