Good point.

In the example given, Myfld1-3 are ID codes making up a composite primary

I've also got single digit flag fields. Most of the fields that I'll be
doing arithmetic calculations will have decimal points. Of course, now
that I liike at the data a bit close, they are implied decimals...but
that's another issue.

I was already looking out for fields defined as numeric that really might
be better suited to char due to the need for substring.


On Wed, Jan 22, 2014 at 2:46 PM, CRPence <CRPbottle@xxxxxxxxx> wrote:

On 22-Jan-2014 10:51 -0800, Charles Wilt wrote:
Philosophical question for you all...

I'm creating a new table to hold data received from an external source.

The specs given include

Name, Type/Length, Picture
MyFld, N/5, 9(5)

So MyFld is a 5 digit number...

I could defined this as Packed/Zoned 5,0
Or I could use integer (or even small integer since the current
number of values is less than 1000)

Since I know DB2 and RPG for that matter perform best with integer,
I'm leaning that direction. But I can't help but think that Packed
(5,0) is more correct.


I would decide according to the storage requirements for the data [in
both dataspace and an access path], and according to how the data will
be used in programs and queries which is likely dependent on what the
data represents. I infer from the comment about "perform best", that
the data might be used in calculations [e.g. aggregates]? But was that
implied? The /digits/ might instead, effectively never get used in
arithmetic calculations; perhaps used only in derivations that might
just as easily be a substring, such that storage as numeric may have
little value other than decreased storage requirements.? And if the
digits represent something else like a time or a date, then possibly
better stored as that respective data type. What I mean about depending
on what the data represents: A 5-digit zip-code or a YYJJJ date value
might be represented better as something entirely different than how a
5-digit number that represents the count of a number of items that might
need to be summed or decremented.

Regards, Chuck
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list
To post a message email: MIDRANGE-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
or email: MIDRANGE-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives

This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2019 by 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].