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

Decimal Part

former_member384574
Active Participant
0 Likes
531

Hi experts!!!

I need to cut the decimal part of my P data....

DATA: auxiliar type I,

aux type C,

valor type P decimals 2.

valor = '5.50'.

aux = FRAC( valor ).

auxiliar = trunc( valor ).

But when I do this, in aux parameter I only received 1... does anybody know the problem? How can I cut the decimal part of the number 5.50?

Aux = 0.50.. there's any way?

Thanks a lot!!

Regards,

Rebeca

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
508

DATA: auxiliar type I,

aux type Char10,

var1 and var2 type char10.

valor type P decimals 2.

valor = '5.50'.

move valor to aux.

SPLIT aux at '.' into var1 var2.

Var2 will have the decimal part.

Regards,

Prashant

Hi experts!!!

I need to cut the decimal part of my P data....

DATA: auxiliar type I,

aux type C,

valor type P decimals 2.

valor = '5.50'.

aux = FRAC( valor ).

auxiliar = trunc( valor ).

But when I do this, in aux parameter I only received 1... does anybody know the problem? How can I cut the decimal part of the number 5.50?

Aux = 0.50.. there's any way?

Thanks a lot!!

Regards,

Rebeca

3 REPLIES 3
Read only

Former Member
0 Likes
509

DATA: auxiliar type I,

aux type Char10,

var1 and var2 type char10.

valor type P decimals 2.

valor = '5.50'.

move valor to aux.

SPLIT aux at '.' into var1 var2.

Var2 will have the decimal part.

Regards,

Prashant

Read only

Former Member
0 Likes
508

Hi,

Try this


 DATA d TYPE p DECIMALS 2.
 data value type dmbtr value '5.50'.
 d = FRAC( value ).
 write : d.

regards,

Advait

Read only

0 Likes
508

Thanks!!!