Why does a CA Ideal dataview listing show "P" for a Key?

Document ID : KB000014008
Last Modified Date : 14/02/2018
Show Technical Document Details
Introduction:

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).

DVWL : DISPLAY DATAVIEW      DVW CUSTOMERS (003) PROD        SYS: $ID   DISPLAY
Commnd Seq Level Field name           T I Ch/Dg Occur K Value/Redef/Dep on    
====== ================================ T O P =================================
000001 CATALOGED 10/15/15 17:44      DATACOM/DB UPD=YES DBID=00010            
000002                                                                         
000003   1 1     CUSTOMERS                                                    
000004   2  2     CUST-ID                             K                        
000005   3   3     IND-CD             X       1       P                        
000006   4   3     CUST-NO            X       4                                
000007   5  2     NAME                X      30       K                        
000008   6  2     ADDR-1              X      30                                
000009   7  2     ADDR-2              X      30                                
000010   8  2     CITY                X      15                                
000011   9  2     STATE               X       2                                
000012  10  2     ZIP                 X       9                                
000013  11  2     CRED-IND            X       1       K                        
000014  12  2     PHONE                                                        
000015  13   3     AREA-CD            X       3                                
000016  14   3     PH-EXCH            X       3                                
000017  15   3     PH-NO              X       4                                
000018  16  2     OPEN-$              N P  7.2                                
000019  17  2     YTD-SALES           N P  7.2                                
000020  18  2     ACT-DT                                                      
000021  19   3     ACT-YR             X       2                                
000022  20   3     ACT-MO             X       2                                
000023  21   3     ACT-DAY            X       2                                
000024  22  2     SLMN-ID             X       5                                
====== ============================= B O T T O M ==============================

 

Question:

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:

Key: CRED (CRED-IND-KEY)
Occurrence                         Seq Offset Length
CRED-IND                             1    121      1

Key: CUSID (CUST-ID-KEY)
Occurrence                         Seq Offset Length
IND-CD                               1      0      1
CUST-NO                              2      1      4
IND-CD                               3      0      1
CUST-NO                              4      1      4

Key: IDNO (CUST-IDNO-KEY)
Occurrence                         Seq Offset Length
IND-CD                               1      0      1
CUST-NO                              2      1      4

Key: NAME (NAME-KEY)
Occurrence                         Seq Offset Length
NAME                                 1      5     30

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.

CA Ideal version 14.0 Bookshelf

CA Datacom Tools - 15.0 DocOps Website

As always, please contact CA Technologies support for CA Datacom if you have further questions.