A Hidden Value question was posed about how manual and automatic masters work in TurboIMAGE. Roy Brown gave a fine tutorial on how these features do their jobs for MPE and the 3000 -- as well as how a detail dataset might have zero key fields.
Manual masters can contain data which you define, like Detail sets can, along with a single Key field. Automatic masters contain only the Key field. In both cases, there can be only one record for a given key value in a Master dataset.
A Detail dataset contains data fields plus zero, one, or many key fields. There can be as many records as you like for a given key value, and these form a chain accessible from the Master record key value. This chain may be sorted, or it may just be in chronological order of adding the records.
Brown explained that "where there are keys, referential integrity demands that there are no Detail record entries with a key field that is not found in either a Manual or Automatic master, both Key name and Key value. So a Detail data set with Key fields that are not present in a Master record would be a sign of a seriously corrupted database."
However, I doubt this is the case, and when you do a QUERY FORM command, you will see which fields in Detail datasets are Keys, which fields are used to establish Sort orders, and which fields are data pure and simple.
From the Key name, you can determine which Master set links the keys.
As I said above, it is possible to have a Detail dataset with no keys, but these usually contain only a very few records, since direct access to them without keys is cumbersome, and you would otherwise have to trawl right through one to find any given entry.
So a Detail dataset with thousands of unconnected entries would be very unlikely.
The FORM output will allow you to check how the Detail dataset that you think might have unconnected entries is actually linked in.
Brown's explanation flowed from the following question and answer in that Hidden Value article.
I want to generate a listing of data sets, data item names, and their relationships from my TurboIMAGE database (master, One detail data set has thousands of entries which do not appear to be connected to any master. I cannot remember the difference between manual and automatic masters.
Francois Desrochers replied to use Query's FORM command.
PASSWORD = >> password
MODE = >> 5
Manual masters: programs have to explicitly add entries before you can add related entries in detail sets. Programs have to explicitly delete entries when there are no related detail entries left. In other words, you have to do master dataset maintenance.
Automatic masters: entries are automatically created when a related detail set entry is created. Entries in the master are automatically removed when the last related detail entry is deleted. IMAGE takes care of the maintenance.
1. You have to add records to the manual master that contain the key data for any detail datasets that are linked to the master.
2. When working with automatic masters, you don't have to write data to them at all. IMAGE takes care of populating the master.
Krikor Gullekian also noted that "With QUERY you can check the databases as long as you know the password." [Ed. note: This password advice is true, except when you're the database owner. No password is required then, only a semicolon.]