Page 1 of 1

PL/I decimal scaling factor

PostPosted: Sat Jan 12, 2008 1:27 am
by Joyce
I need a concise definition/explanation of the PL/I decimal scaling factor. My Google searches so far haven't been fruitful. Any recommendations? Thanks.

Re: PL/I decimal scaling factor

PostPosted: Mon Jan 21, 2008 3:54 pm
by whale
Fixed decimal is nothing but it is packed decimal .
Type of data = coded arithmetic
Default Precision = 5 decimal digits
Maximum Precision = 15 decimal digits

It is very usefull when calculation has to be done.
It is more efficient to declare the precision of fixed decimal data as an odd number.

The no of bytes required to store tha data is = (n+1)/2

Re: PL/I decimal scaling factor

PostPosted: Mon Jan 21, 2008 4:39 pm
by whale
This also helps .

FIXED DEC(5,2) takes
5*(1/2 byte) + 1/2 byte for sign = 3 bytes

FIXED DEC(4,2) or FIXED DEC(4,0) (as is the case here).

4*(1/2 byte) + 1/2 byte for sign = 2 and half bytes. But the remaining 1/2 byte is wasted. So it too occupies 3 bytes.


FIXED DEC in PL1 is equal to COMP-3 in Cobol

eg: FIXED DEC(5,1) = 9(4)v9(1) comp-3