If you are creating a data layout for an indexed file, you can use the File Designer's Key tab to specify one or more keys. Rules for primary and alternate keys can be found in Environment Division.
All of the fields that you define in the Description tab appear in the Fields description list in the bottom, left portion of the interface. Use this list to build your key(s) as follows.
- In the Fields description list, double-click an item to add it to the Selected Fields list. You can also click an item (or Shift-click or Ctrl-click to select multiple items), then click the right arrow (>) to add them to the Selected Fields list. To add all fields to the list, click the >> button.
All fields in the Selected Fields list when you create a new key are added to the key. If you have mistakenly added a field to the list, use the left arrow
(<) button to remove it. To clear the Selected Fields list, use the << button.
- To add the fields in the Selected Fields list as a key, click the Add button (first in the set of four to the right of the Key list label). You can also right-click in the Key list area and select Add. The selected fields appear in the Key list.
This two-step process for creating keys makes it easier to add split keys, constructed from multiple non-contiguous fields.
- To add or change a key name, double-click in the Key Name field and enter the name.
- To change key type (unique primary, primary allowing duplicates, unique alternate key, alternate key allowing duplicates),
double-click in the Type field and select an option from the drop-down list.
- To insert a comment, click in the Comment field and then click the button that appears.
To change a key for an indexed file:
- In the Key list select the key that you want to change. Note that the key fields of the selected key are listed in the Selected Fields list.
- Add or subtract items from the Selected Fields list until you have the fields that you want.
- Change the key by clicking the Modify button (second in the set of four to the right of the Key list label).
To remove a key, select the key in the Key list, then click the Delete button (third in the set of four buttons to the right of the Key List label). To clear all of the key definitions and start again, use the Delete All button (the fourth button in the set).
When you are finished defining and editing key information, you can do any of the following:
- To determine what file handling code AcuBench can generate for this data layout, continue to Defining File Handling Behavior.
- To create a custom XFD for the data file, continue to Designing a Custom XFD.
- If you are finished creating your data layout file, close the File Designer, then right-click the icon for your new DLT in the Data view and select Generate FD/SL from the pop-up menu. The information in your data layout file is now available to the programs in your project.