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

Fixed point Arithemetic.

Former Member
0 Likes
710

Hi all,

data: g(16) type c value '23.75',

k(12) type c value '1.00000',

l(16) type c.

l = g * k.

CONDENSE l.

write: l .

the above code will give 23.75 if FIXED POINT ARITHMATIC CHECKBOX is checkd in the program attributes.

Other wise it will give output as 237500000.

I am using such type of code in an Enhancement Implementation . there iam not able to check FIXED POINT ARITHMATIC CHECKBOX .

in such case how can i prceed with FIXED POINT ARITHMATIC ..? .

Thanks in advance,

sarath P

5 REPLIES 5
Read only

chaiphon
Contributor
0 Likes
613

If you cannot check FIXED POINT ARITHMATIC CHECKBOX.

try this.


data: g type p DECIMALS 2 value '23.75',
k type p DECIMALS 5 value '1.00000',
l type p DECIMALS 7.
l = g * k.
write: l decimals 2.

Cheers,

Chaiphon

Read only

Former Member
0 Likes
613

Chaiphon ,

its working fine .. thanks

Read only

chaiphon
Contributor
0 Likes
613

the problem is because you are defining v_lc_netwr type ekpo-netwr which have only 3 decimals.

for calculating without FIXED POINT ARITHMATIC CHECKBOX. you need to calculate the total decimal points.

in this case netwr has 2 decimal and wkurs has 5 decimals so the total variable should have 7 decimals.

Read only

Former Member
0 Likes
613

Well then declare your resultant variable as type p decimals 8. This will take care of the output for the exact result.

Read only

Former Member
0 Likes
613

But why are you doing arithmetic operations on character data? It is much more efficient to use packed decimal.

Rob