DB2 Data Packing

Uniface data types and packing codes are mapped to DB2 storage formats.

For more information on Unicode data packing, see Unicode Packing Codes .

Mappings Between Uniface Packing Codes and DB2 Storage Format
Uniface Packing Code DB2 Storage Format
B1-B4 Char
C1-C254 Char
C255-C3999 Varchar
C4000-C32700 Long Varchar
C32701... CLOB
C* Varchar
D, D1-D13 Date
E, E1-E13 Timestamp
F Decimal
F4 Float
F8 Double
I1-I2 Smallint
I3-I4 Integer
I8 Bigint
J1-J30 Decimal
J31-J32 Float
M1 Decimal
M2-M3 Float
M4, M6 Decimal
N1-N32 Decimal
O1-O31 Zoned numeric
O32 Float
P1-P8 Decimal
Q1-Q8 Decimal
R1-R254 Char For Bit Data 1 >

Graphic 2

R255-R3999 Varchar For Bit Data 2 >

Vargraphic 3 >

R4000-R32700 Long Varchar For Bit Data

Long Vargraphic 3

R32701... BLOB 2 >

DBCLOB 3 >

SC... Char(1) For Bit Data + Long Varchar 34

DBCLOB 56

CLOB 7 >

SR... Char(1) For Bit Data + Long Varchar For Bit Data5

BLOB 7 >

SW... DBCLOB 6

CLOB 7

T1, T2, T4-T6 Time
T3 Timestamp
U1-U254 Char
U255-U3999 Varchar
U4000-U32700 Long Varchar 1 >
U32701... CLOB
U* Varchar
VC1-VC254 Char
VC255-VC3999 Varchar
VC4000-VC32700 Long Varchar
VC32701... Long Varchar For Bit Data
VC* Varchar
VR1-VR254 Char For Bit Data 2 >

Graphic 3 >

VR255-VR3999 Varchar For Bit Data 2 >

Vargraphic 3 >

VR4000-VR32700 Long Varchar For Bit Data and 2

Long Vargraphic 3 >

VR32701... BLOB 2 >

DBCLOB 3 >

VU1-VU254 Char
VU255-VU3999 Varchar
VU4000-VU32700 Long Varchar
VU32701... CLOB
VU* Varchar
VW1-VW3999 Vargraphic 6

VarChar 7

VW4000-VW32700 Long Vargraphic 6

Long VarChar 7 >

VW* Vargraphic 6

VarChar 7

W1-W254 Graphic 6

Char 7

W255-W3999 Graphic 6

Varchar 7 >

W4000-W32700 Long Graphic 6 >

Long Char 7

W32700... DBCLOB 6

CLOB 7

W* Graphic 6 >

Char 7

  1. If nls is disabled.
  2. If nls is enabled.
  3. If segmented fields is disabled.
  4. If unicode is disabled.
  5. If segmented fields is enabled.
  6. In Unicode database.
  7. In non-Unicode database.

The storage formats used by DB2 are shown in the table. The table is intended as a guide, not a complete discussion of DB2 storage formats. If you are in any doubt about the exact requirements in your environment, see your DB2 documentation for more information.

DB2 Storage Formats
Storage Format Description
Character Fixed-length field that can contain any ASCII character. They have a maximum length of 254 bytes and are left-justified.
Varchar Variable-length string. The maximum length is 4000 bytes, of which the first two bytes are used for the length of the field. In all other respects, Varchar fields are the same as character fields.
Long Varchar Variable-length string, with a maximum length is 32,700 bytes.
Small Integer Two-byte signed integer with a precision of 15 bits. This allows a range of -32,768 through 32,767.
Large Integer Four-byte signed integer with a precision of 31 bits. This allows a range of -2,147,483,648 through 2,147,483,647.
Floating Point Float fields contain eight-byte (double-precision) floating point binary numbers.
Real Real fields contain four-byte (single precision) floating point binary numbers.
Decimal Decimal fields contain packed decimal numbers with an implied decimal point. The position of the decimal point is determined by the scale of the number. The maximum length is 31 digits.
Date Date fields contain dates. Dates contain a value for days (range 01 through 31), a value for months (range 01 through 12), and a value for years (range 0001 through 9999).

Uniface Date formats allocated to a Datetime packing code have no time component. These are mapped to the DB2 Timestamp data type. If no time is available with a date record, 00:00:00.000000 will be added by default.

Time Time fields contain times. Times consist of a two-byte value for hours (range 01 through 24), a two-byte value for minutes (range 0 through 59) and a two-byte value for seconds (range 0 through 59).

Uniface Time formats allocated to a Datetime packing code have no date component. These are mapped to the DB2 Timestamp data type. If time is recorded without date information, Uniface automatically adds the date understood by DB2 as the base date, that is, 01/01/0001.

Timestamp Timestamp fields contain combined date and time values. A timestamp field contains seven components (year, month, day, hour, minute, second, and microsecond).
Graphic

Graphic columns defined in Uniface as String with packing code Raw will be translated as pure double-byte strings if nls has been enabled in the Uniface assignment file.