My understanding of the reason so many of us are accustomed to not keying the PF is that early on keys could not be modified. So, if the key was on last name and she got married, her record could not be corrected. It was copy & delete, which was a major pain if the name file had many child files. That was changed decades ago, but it is a tough habit to break.

On 7/31/2012 7:58 AM, rob@xxxxxxxxx wrote:
Whenever I can I key my physical files and make them unique.

I have some table files that I
RGZPFM FILE(MYFILE) KEYFILE(*FILE)
whenever I add records. Doing it on most files make sense. UNLESS you
primarily access by a different order. An example might be a name file.
If a vast majority of accesses are by name and rarely by the 'key' it
might make sense to reorg that by logical built over the name. Even this
could be improved upon. Most PF's that are keyed omit the active record
code from the key. Those it might be better to reorg by a key that is
built over active record id and then the key.

Our ERP software never keys the PF. They never specify unique in their
LF's either. They try to get uniqueness by imbedding the logic into
programs. When we do merges, acquisitions, migrations, etc., we often
have to scrub the data to get uniqueness. Imagine an item number in the
file twice. Once with an active record flag, again with an inactive
record flag.

I prefer to protect database integrity by using primary unique keys, by
using foreign keys, by using check constraints, by journalling, etc. Stuff
that most of DDS rarely even pays lip service to.

Rob Berendt



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

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

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

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.