Previous Topic: Explicit MethodNext Topic: Define Fields to the Key


Add KEY Substructures

Use the ADD KEY function to define the base occurrence of a KEY substructure. CA Datacom Datadictionary automatically relates the KEY occurrence to the existing TABLE occurrence that you specify.

Adding keys can improve data retrieval. If a new KEY occurrence replaces an existing Master Key or Native Key, update the attribute-values for the previously defined Master or Native Key so it is no longer designated as a Master or Native Key. A table can have only one Master Key and one Native Key. A single KEY occurrence can be both the Master Key and the Native Key for a table.

How to Use

You can define a KEY occurrence by using one of the following procedures:

When you select the ADD option on the KEY Structure Functions Panel, you receive the following prompter panel:

=> => => 1-DDOL000196A - CMPP - PLEASE COMPLETE REQUIRED INFORMATION FOR COMMAND ----------------------------------------------------------------------------- DATACOM/DB Structure Maintenance TACF ADD KEY ________________________________ ADD KEY (name) TO TABLE ________________________________ in STATUS ____ TO TBL (name) STA (status) with PASSWORD using LOCK 0 LIKE ________________________________ PSWD (pswd) LOC (lock) LIKE (name) PF1=HELP PF2=END PF3=CLARIFY PF4=PROCESS PF5=MENU PF6=STATUS PF7=SCB PF8=SCF PF9=APPLY PF10=PATH PF11=NEXT PF12=INPUT

The following list describes each field, the valid entries and the default (if one exists). Fields that require an entry are highlighted on your terminal. Fields which are not highlighted indicate that an entry is optional.

KEY (name)

(Required) Specify the name for the occurrence you are adding.

Valid Entries:

1- to 32-character name

Default Value:

(No default)

TABLE (name)

(Required) Specify the name of the existing occurrence.

Valid Entries:

1- to 32-character name

Default Value:

(No default)

(status)

(Required) Specify the status of the existing TABLE occurrence.

Valid Entries:

T001—T999

Default Value:

(No default

(pswd)

(Optional) Specify a password to protect this occurrence from unauthorized updates. For more information, see the section on protecting definitions in the CA Datacom Datadictionary User Guide.

Valid Entries:

1 to 4 alphanumeric characters

Default Value:

(No default)

(lock)

(Optional) Specify a lock level to restrict access to this occurrence.

Valid Entries:

0, 1, or 2

Default Value:

0

LIKE (name)

(Optional) Specify the name of an existing KEY occurrence in the same status to use as the model for the occurrence you are adding. When you use the LIKE option with a KEY occurrence, the FIELD occurrences associated with the KEY are not carried forward.

Note: Any aliases or descriptors assigned to the existing occurrence are not duplicated for the new occurrence. Define these separately.

Valid Entries:

1- to 32-character name

Default Value:

(No default)

When you press Enter, the KEY definition panel appears. Complete the definition of the KEY occurrence by assigning attribute-values in the KEY ATTRIBUTES region.

=> => => 1-DDOL000407A - 09IP - KEY HAS NO RELATED FIELDS ----------------------------------------------------------------------------- DATACOM/DB STRUCTURE MAINTENANCE ADD TUKU .............................. KEY ATTRIBUTES ................................ Name : CUST-ID-KEY Status/Version: T001 Type: _ Table : ACCTS DB-Name: _____ Id: ___ Master-Key: _ Native-Seq: _ Nil: _ Unique: _ ..............................FIELD ATTRIBUTES ............................. EC Field Name Order Data-Sen Length Compiler-Name Assembler-Name ==== = =================== T O P ====== =================== = ===== = ==== === 0001 ________________________________ _ _ ___ ____________________________ ________ ==== = ================ B O T T O M === =================== = ===== = ==== === PF1=HELP PF2=END PF3=CLARIFY PF4=PROCESS PF5=MENU PF6=STATUS PF7=SCB PF8=SCF PF9=APPLY PF10=PATH PF11=NEXT PF12=INPUT

The following list describes each attribute, the valid entries, and the default (if one exists). Attributes that require an entry are highlighted on your terminal. Attributes which are not highlighted indicate that an entry is optional. If you do not assign a value to these attributes, they default to the value assigned in CA Datacom Datadictionary.

Type:

(Optional) Specify whether the key is an index or a partitioning key.

For more information, see the TYPE attribute-type for KEY occurrences in the CA Datacom Datadictionary Attribute Reference Guide.

Valid Entries:

I or P

Default Value:

I

DB-Name:

(Required) Type a name that is unique within the TABLE substructure. CA Datacom/DB uses this name to identify the key.

For more information, see the DATACOM-NAME attribute-type for KEY occurrences in the CA Datacom Datadictionary Attribute Reference Guide.

Valid Entries:

Five alphanumeric characters

Default Value:

(No default)

Id:

(Optional) Specify a number to identify the key internally. If you do not enter a value for this attribute, CA Datacom Datadictionary assigns a number that is unique within the DATABASE structure when the SET function is executed.

For more information, see the DATACOM-ID attribute-type for KEY occurrences in the CA Datacom Datadictionary Attribute Reference Guide.

Valid Entries:

1—999

Default Value:

CA Datacom Datadictionary assigns an available number when the SET function is executed if you do not enter a value.

Master-Key:

(Optional) Specify Y if this KEY occurrence is the Master Key of the table. A table can have only one Master Key. If the MASTER-KEY attribute-value is Y, the DATACOM-ID for the key must be unique for all KEY occurrences for the same table.

For more information, see the CA Datacom/DB Database and System Administration Guide for a detailed explanation of this attribute and to the MASTER-KEY attribute-type for KEY occurrences in the CA Datacom Datadictionary Attribute Reference Guide.

Valid Entries:

N or Y

Default Value:

N

Native-Seq:

(Optional) Specify Y if this KEY occurrence is the Native Key of the table. A table can have only one Native Key. However, the same KEY occurrence can be both the Master and Native Key.

For more information, see the NATIVE-KEY attribute-type for KEY occurrences in the CA Datacom Datadictionary Attribute Reference Guide.

Valid Entries:

N or Y

Default Value:

N

Nil:

(Optional) Specify Y if keys that are all blanks (X'40') or all binary zeros (X'00') are included in the CA Datacom/DB index. Specify N if these values are excluded from the index.

For more information, see the INCLUDE-NIL-KEY attribute-type for KEY occurrences in the CA Datacom Datadictionary Attribute Reference Guide.

Valid Entries:

Y or N

Default Value:

Y

Unique:

(Optional) Specify Y if the value of the key must be unique within the table.

For more information, see the UNIQUE attribute-type for KEY occurrences in the CA Datacom Datadictionary Attribute Reference Guide.

Valid Entries:

N or Y

Default Value:

N