A key determines the order in which records will be retrieved from the file.
To Add a Key to a Record Format
- Open the physical file definition source file in the Database File Definition Designer.
- In the details tree view of the designer, select the record format node as shown below with the RCMMASTER record format.
- Select the Keys tab in the lower right panel to display the keys grid as shown below.
- Scroll to the bottom of the keys grid, if necessary. Select the New Row (the last row of the grid) by clicking on the leftmost column of the row.
- Select the name of the key part to add by clicking on the drop-down box in the KeyName cell as shown below. Modify the remaining default column values of the New Row to reflect the attributes of the key part to be added to the record format. Note that a key part will not be added to the format until you select a field or make a change to the default data.
- Click Add to create the new file definition and add it to the project.
The new file definition is created in a file in the project folder. If the file definition is for a print file, the extension of the file is ".apd". The extension for database file definitions is ".dgdef". The file definition added to the project can now be opened for editing by double-clicking on the file in Solution Explorer.
You can change attributes of the key part by modifying the following column parameters.
Keyname:
Click on the arrow on the right of the key name cell and select one of the available fields to designate as a key field. A key name is required.
Key Order:
Click on the arrow on the right of the key order cell to select the order in which the key field will be sorted. The default is ascending order.
Ascending - Alphabetical order, from A to Z.
Descending - Alphabetical order, from Z to A.
Key Usage:
Select a usage by clicking the arrow on the right of key usage cell. The following are the available usage types.
- Absolute Value – Absolute value numeric sequence.
- Signed – Algebraic numeric sequence.
- Unsigned – Ignore the sign when sorting.
- Digit – The low nibble of each byte of the key field.
- Zone – A numeric type where there is a byte per digit, divided into a low andhigh nibble.
You can add a maximum of 32 key fields. The total LeftPad of the key can be up to 250 Bytes.
Inserting a New Key Part before an Existing Key Part
- Append the new key part as detailed above.
- Select the new key part row, then click and drag the row to the key part row in the grid where you want to insert the new key part.
- Drop the new key part on top of the existing key part. The new key part is inserted before the existing key part.
Section summary:
- Create or Open a DataGate Project
- Add New Database File Definition
- Open the Database File Definition Designer
- Add Field(s) to the Record Format
- Add Key(s) to the Record Format
- Add Select/Omit Rule
- Create the Final File
- File Types, Data Type Keywords and Parameters
- The File Definition Document Editor