Integer Packing Code (I)

The I packing codes are used to store binary integers. Storage size in bytes is indicated by the number attributed to the packing code; for example, I4 is a 4-byte binary integer field.

By definition, integers are whole numbers. Therefore, no scaling is allowed in a conventional DBMS storage format. However, scaling can be specified in Uniface with an I packing code.

Range of Values

The values shown here differ between DBMSs because some DBMSs have two values for zero (+0 and -0) while others only have one (0). Refer to your DBMS documentation for more information.

Range of Values for I Packing Codes
Packing codes (no scaling) Range of possible values

(DBMS-dependent)

I1 -2 7 through (2 7 )-1
I2 -2 15 through (2 15 )-1
I3 -2 23 through (2 23 )-1
I4 -2 31 through (2 31 )-1
I8 -2 63 through (2 63 )-1
I16 -2 127 through (2 127 )-1

Scaling

Scaling for integer fields is a contradiction in terms, because integers are, by definition, whole numbers. If the underlying DBMS can handle scaled integers, they are stored in this way. However, only Uniface is likely to understand that scaling has been specified, and carry out the necessary conversion. Other software does not understand scaling with data packed in this way unless it is explicitly programmed to treat the stored number as scaled.

Specifying a scaled packing code sets the default field layout definition.

The syntax for scaling with the I packing code is:

Im{.n}

  • m is the total length of the field to be stored in bytes
  • n is the (optional) number of digits after the decimal. If n is present, a period (.) must separate n from m.
Examples of Scaling with I Packing Codes

Examples (with scaling)

Range of possible values

(DBMS-dependent)

I2.2

-327.68 through 327.67

I4.5

-21,474.83648 through 21,474.83647

Related Topics