| 
 | 
Sadiq:
<snip>
When you have a field of length say eleven and want to define in terms
of
packed decimal then we need to calculate with  formula i.e. N+1 / 2 = 6
length 
When you look at a field of 6p then want to determine what length of
value
would it accommodate then it would be N X 2 - 1 = 11 length 
</snip>
If you define a field as follows:
     d field           s              6p 2 inz
The field is a 6-digit value with two decimal places (max value
9,999.99).
If you define a field this way:
     d field           s         1    6p 2 inz
The field is now 11-digits with two decimal places (max value
999,999,999.99).
The first way indicates a 6-digit field with 2 decimal places.  The
second indicates that 6-bytes of storage are used for a packed field,
which is big enough to hold 11-digits with 2 decimal places.
If you only specify the length that indicates the number of digits.  If
you indicate start and end positions, you get physical storage size
(your [n*2]-2 calculation).
--Bruce Guetzkow
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.