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.