Indexes
Indexes (known as keys in DataCom tables) provide an efficient means for accessing a DataCom table. To access the index definition screen of DataCom tables in AMT-COBOL Developer:
- Open the DataCom table definition that the index is related to by first opening the "Database" folder from the repository window followed by the "DataCom" sub-folder. Double-click on the required DataCom table name then select the "Indexes" node in the left-hand pane.
Creating an index
- To create a new index, you must use method described above and open the DataCom table definition first.
- Select the "Indexes" node in the left-hand pane, then click "Add new index" in the right-hand pane (or right-click the "Indexes" node then select "Insert" from the pop-up menu).
- The Index screen appears where you define the properties for the index. To complete the specification, see "Adjusting an index" below.
Adjusting an index
- To adjust an existing index, access the index as described above.
- The index properties screen is shown below:
The following is a description of the index properties:
Property: |
Description: |
Value: |
Name |
Name of the index. |
<Text> |
Description |
Description of the index. |
<Text> |
Sql Name | Optional property in which the name of the DataCom index as used in the AMT user database can be set. If left empty, the name as set in the "Name" property (see above) will be used. |
<Text> |
DataCom Name | Name of the DataCom index for usage in the COBOL code. | <Text> |
DataCom Id | The Id of the DataCom index which is returned in the results. | <Text> |
Unique index | If checked, then AMT-COBOL will enforce that key values created in the index will be unique. Any
attempt to create records with non-unique key values will result in a SQL error. If unchecked, then the index keys can have non-unique values. |
Checked | Unchecked |
Master index | Check to set this index as Master index (key) for the DataCom table. | Checked | Unchecked |
Native index | Check to set this index as the Native index (key) for the DataCom table. | Checked | Unchecked |
Has Nil Keys | Check to enable the indexing of nil values. | Checked | Unchecked |
Filegroup/ Tablespace |
Name of the MS-SQL filegroup or Oracle tablespace, as is defined by the database administrator. |
<Text> |
Default fill factor |
If checked, the index will use the default fill factor that is specified in the application options. If unchecked, the fill factor for the index will be set according to the value that is specified in the edit box on the right. For more help on determining a suitable value, please refer to the description for the default fill factor setting in the application options screen. |
Checked | Unchecked & <Integer> |
Keys (panel) |
The keys for the index. |
<Db Field> & <Sort order> |
Include Extra Columns (KeyOnly Reads) |
When performing KeyOnly reads the Columns selected in this panel will also be read beside the Columns
of the Index Keys. The Columns selected will be added to the index but will not affect the unique
constraints of the index. When using an Oracle database, including extra columns on a unique index will create an additional index on the database named: <Tablename>_<indexName>_UNIQUE |
<Db Field> |
- On completion, click the save button in the top toolbar of the Developer.
|
Deleting an element
An element can be removed from the repository by selecting the element definition in the DataCom table and pressing the keyboard 'Delete' key.
Generate the application and reorganize the database
After an index is added, adjusted or deleted, a Whole System generate is required, followed by a database reorganize.