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.

Thoughts?

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.


This thread ...

Follow-Ups:

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

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