When looking at a display of a CA Datacom/DB dataview for a table, the Key column displays "K" for a key comprised of only this field, or a "P" for the high-order portion of a key. This listing can sometimes be confusing, and a further explanation of this column is needed.

For example, here is a listing of the CUSTOMERS dataview from the CUST table (CUS) in the ORDER-ENTRY sample database (DB 10).

When reviewing a display of a Dataview in CA Ideal, why does the Key column show "P" for a Key? Is this a partial key, and does it mean the whole key will not be used?

Answer:

According to the Utilizing CA Ideal for CA Datacom > Using CA Ideal for CA Datacom > Managing Dataviews section of the documentation, here is what the Key ("K") column means (specifically for CA Datacom/DB table dataviews):

K (Key)-(CA Datacom®/DB native access and SQL access) The key column that indicates whether a field is defined as a key or part of a key in the dataview.

The field is a full key

The field is a partial key (high order portion of a key)

If the field is not a full or partial key, there is no entry in this column.

For example, in a dataview where KEY1 consists of FIELD1 and KEY2 consists of FIELD2,FIELD3, the corresponding dataview display identifies the three fields as follows:

FIELD1 K (full key)FIELD2 P (partial key)FIELD3 (no entry)

Since only the high order portion of a multi-field key can be a partial key, FIELD3 is not a partial key.

If a key has 65 or more FIELDs defined in the dictionary, CA Ideal™ for CA Datacom® only recognizes the first 64 FIELDs, and lists only the first as a partial key.

As shown above, since Field1 is the only field used in a key (KEY1), it has the "K" value. Then, since Field2 is the high-order field in another key (KEY2), it contains the "P" to identify it has the high-order partial key in a multi-field key definition. With multi-field keys, only the high-order field is identified.

Now, in the first dataview listing for CUSTOMERS, Fields 2, 5, and 11 (CUST-ID, NAME, and CRED-IND, respectively) are identified with "K" because there are keys that each contain only those fields. Field 3 (IND-CD) is identified with a "P" because it is the high-order field in some other multi-field key. This is seen by reviewing the keys on this table:

For this table, Field 2 (CUST-ID) is a group field, made up of IND-CD and CUST-NO, which is the full key definition for key IDNO, so it gets a "K" here. Field 5 (NAME) is the only field in the key NAME, so it also gets a "K" here, and Field 11 (CRED-IND) is the only field in the key CRED, so it likewise is a "K". Field 3 (IND-CD) is the high-order field in the multi-field key CUSID, so it gets the "P" value. Note that even though the "P" partial key identifier is used here, this does not mean that the dataview will only process data using this partial key. Data management is done within the Multi-User Facility (called MUF) based on the CXX and Datadictionary definitions for the keys, and issues like duplicate key values, etc., are determined by the key definition and program logic.

Since key fields can be non-contiguous or not located together, and since they can be in any order, there is no benefit to trying to identify them in this dataview listing, so only the full key and partial key high-order fields are shown. For full key details, you should consult the CXX report for the database and table.

Additional Information:

For more information about dataviews in CA Ideal, please refer to the following documentation.