Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Packed Decimal vs. Integer in DB2

396 views
Skip to first unread message

Rompot, Kurt

unread,
Aug 14, 1998, 3:00:00 AM8/14/98
to
I've always use SMALLINT and INTEGER to represent integer values in DB2
tables.

I am now in a shop that is converting from Datacom to DB2. In Datacom, they
represented everything with packed decimal. They were planning on doing the
same with DB2: Numeric (5,0) instead of Integer.

I'm looking for a persuasive argument for one approach or the other.
Currently, the main programming language used to access DB2 is Cobol, but
that will gradually shift to Java/C in the future.

Any opinions?

Darius Cooper

unread,
Aug 14, 1998, 3:00:00 AM8/14/98
to
SPACE: as you can see from this "table" sometime DEC occupies more space
than smallint/int and sometimes it occupies less:
1 digit: SMALLINT 2 byte, DEC 1 byte
2-3 digits: SMALLINT 2 bytes, DEC 2 bytes
4 digits: SMALLINT 2 bytes, DEC 3 bytes
5 digits: INT 4 bytes, DEC 3 bytes
6-7 digits: INT 4 bytes, DEC 4 bytes
8-9 digits: INT 4 bytes, DEC 5 bytes
over 9 digits: must be DECIMAL


Rompot, Kurt wrote in message ...

Peter Schaeffer

unread,
Aug 14, 1998, 3:00:00 AM8/14/98
to
Peter Schaeffer@NEON
08/14/98 04:18 PM

IBM does support decimal data in C. For C++ IBM only provides a "Binary
Coded Decimal Class". However, all computers (PCs, UNIX, JVMs) understand
integers. Integers are also faster and take less space on disk and in
memory. I would argue in favor of using Integers rather than Numeric (5,0)
decimal data mainly because they provide the highest degree of
interoperability and portability across platforms. Of course, some data
values don't easily fit into integers and Numeric data is much better for
these types of data values.

Peter Schaeffer
281-491-4200
www.neonsys.com

"Rompot, Kurt" <ROM...@SCHNEIDER.COM> on 08/14/98 08:56:00 AM

Please respond to DB2 Data Base Discussion List <DB...@AMERICAN.EDU>

To: DB...@AMERICAN.EDU
cc: (bcc: Peter Schaeffer/Dev/Neon)
Subject: Packed Decimal vs. Integer in DB2

Rompot, Kurt

unread,
Aug 14, 1998, 3:00:00 AM8/14/98
to
I've always use SMALLINT and INTEGER to represent integer values in DB2
tables.

I am now in a shop that is converting from Datacom to DB2. In Datacom, they
represented everything with packed decimal. They were planning on doing the
same with DB2: Numeric (5,0) instead of Integer.

I'm looking for a persuasive argument for one approach or the other.
Currently, the main programming language used to access DB2 is Cobol, but
that will gradually shift to Java/C in the future.

Any opinions?

.

Peter Schaeffer

unread,
Aug 14, 1998, 3:00:00 AM8/14/98
to
Peter Schaeffer@NEON
08/14/98 04:18 PM

IBM does support decimal data in C. For C++ IBM only provides a "Binary
Coded Decimal Class". However, all computers (PCs, UNIX, JVMs) understand
integers. Integers are also faster and take less space on disk and in
memory. I would argue in favor of using Integers rather than Numeric (5,0)
decimal data mainly because they provide the highest degree of
interoperability and portability across platforms. Of course, some data
values don't easily fit into integers and Numeric data is much better for
these types of data values.

Peter Schaeffer
281-491-4200
www.neonsys.com

"Rompot, Kurt" <ROM...@SCHNEIDER.COM> on 08/14/98 08:56:00 AM

Please respond to DB2 Data Base Discussion List <DB...@AMERICAN.EDU>

To: DB...@AMERICAN.EDU
cc: (bcc: Peter Schaeffer/Dev/Neon)
Subject: Packed Decimal vs. Integer in DB2

0 new messages