Packing Codes for Numeric Data
The Uniface Numeric and Float data types are associated with many packing codes.
The following tables show the default packing codes for numeric data types, and the complete list of all packing codes for numeric data. Any of the packing codes might be converted to a more optimum storage format by the DBMS connector interface. For more information, see the relevant connector documentation.
Uniface data type 
Default packing code 

Float 
F 
Numeric 
F 
Uniface Packing Code 
Explanation 
Uniface Data Types 
Scaling Allowed 


Numeric 
Float 

C (C20), C1C32 
Number, stored sign left, rightaligned, decimal point included, to a maximum of 9 decimal places 
Y 
Y 
Y 
F 
F is mapped to a default of C20 
Y 
Y 
Y 
F4 
Single precision Ffloat 
Y 
Y 
Y 
F8 
Doubleprecision Dfloat 
Y 
Y 
Y 
G8 
VMS private Gformat 
Y 
Y 

H4 
IEEE 4byte float 
Y 
Y 
Y 
H8 
IEEE 8byte float 
Y 
Y 
Y 
I(12) 
Integer 
Y 
Y 

I1 
1byte integer 
Y 
Y 

I2 
2byte integer 
Y 
Y 

I3 
3byte integer 
Y 
Y 

I4 
4byte integer 
Y 
Y 

I8 
8byte integer 
Y 
Y 

I16 
16byte integer 
Y 
Y 

M1 
Money: 8byte integer 
Y 
Implicit  
M2 
Money: doubleprecision floating point storage 
Y 
Implicit  
M4 
Sybase internal money data type 
Y 
Implicit  
M6 
Sybase small money format 
Y 
Implicit  
N (N20), N1N32 
Number, stored without decimal point 
Y 
Y  
O (O20), O1O32 
Zoned numeric encoding of OpenVMS VAX trailing numeric 
Y 

P (P4), P1P8 
Packed decimal, +/ at beginning of field 
Y 
Y 

Q (Q4), Q1Q8 
Packed decimal, +/ at end of field 
Y 
Y 

Y1Y32 
Userdefined packing code 
Y 
Null Values
When data is stored in a DBMS that does not support NULL values, it is not possible to tell the difference between a value of zero and empty (NULL) in numeric fields with packing codes I, F, P, and Q. Generally, record level DBMSs do not support NULL values. If a field with one of these packing codes explicitly receives a value of 0, Uniface displays it as if the field were empty.
Scaling
If scaling is defined for the packing codes I, F, P, and Q, this is not recognized by the DBMS. The scaling determines a default field layout and how Uniface handles the data. Other software does not understand scaling with data packed in this way unless explicitly programmed to do so.
For example, a field that has been defined as data type Numeric with a packing code of I4.2 (a 4byte integer with two digits right of the decimal point) could accept a value of 123.45 within Uniface. The data would actually be stored as 12345; only Uniface would know where the decimal point should be.
Uniface Precisionâ€”data type Numeric
The I, P, and Q packing codes are internally equal to Uniface floating point precision, that is, a platformindependent precision of 38 digits for the mantissa, plus one for rounding, and four digits for the exponent, as follows:
+/ (99,999,999,999,999,999,999,999,999,999,999,999,999e+/ 9999)
The N and O packing codes are represented internally as a number of digits, of which the maximum is 32, not 38. Therefore, if you want greater precision than 32 digits, you should select an I, P, or Q packing code. When storing data, it depends on the DBMS whether this high precision is supported.
Uniface Precisionâ€”data type Float
For the data type Float, Uniface internally supports a platform independent precision of 38 digits for the mantissa, plus one for rounding, and four digits for the exponent, as follows:
+/ (99,999,999,999,999,999,999,999,999,999,999,999,999e+/ 9999)
When storing data, it depends on the DBMS whether this high precision is supported.
UserDefined Packing Codes
You can define your own packing codes for Numeric fields. To do this, you must define the 3GL format conversion routines required by Uniface.