Create an Indexed Data File

Use this procedure to create an indexed data file. To create a (record) sequential, line sequential, or relative data file, see Create a Non-indexed Data File.

  1. From the Micro Focus Data File Tools window, select File > New, or click GUID-6B939487-68A6-434A-AA58-5DC89A5397F9-low.png (New File).

    The New dialog box appears.

  2. Select Data File, then click OK.

    The Create New File dialog box appears.

  3. In the Filename field, type the name of the data file.
    Tip: You can specify:
    • An absolute path: for example, c:\path\to\file\dat-name.dat.
    • A relative path: for example, dat-name.dat. (The .dat file is created in the directory in which Data File Editor was started.)
    • A Fileshare path: for example, $$FS-server-name\dat-name.dat.
  4. If you are applying a record layout to the data file, click Browse to the right of the Structure File (optional) field, then use the Open dialog box to navigate to and select the structure (.str) file that contains the layout.
  5. In the File Details section, click GUID-1E3884E8-1DFD-4408-A21D-2D5ED6DEA450-low.png beside Organization, then select Indexed.
  6. Click GUID-1E3884E8-1DFD-4408-A21D-2D5ED6DEA450-low.png beside Format, then select an indexed file format.
    Note: Not all indexed formats are compatible with the editor; those that are not, are not displayed.

    For an indexed file, you must specify a primary key, and may specify one or more alternate keys.

  7. Click Define Keys.

    The Key Information dialog box appears.

    GUID-57ACCB48-CF80-46FC-87E5-0393C9B3D65D-low.png

  8. Add a primary key:
    1. On the Key tab, click GUID-AF5B3CAC-8C5F-4E1B-BA3A-9D26E1C1C650-low.png(Insert Before).

      A primary key is created, with a default component. A component defines the start position and length of the key within each record.

    2. In the Compression section, select the appropriate check boxes:
      Leading spaces
      Removes the leading spaces within the value of the key.
      Trailing spaces
      Removes the trailing spaces within the value of the key.
      Duplicates
      For alternate keys only. Only the first duplicate key is contained in the file; subsequent duplicate values are not stored, but information is stored to enable correct recreation of the keys.
    3. Click the Component tab.

      Details for the default component, created when the key was added, appears.

    4. Select Component 0, then specify the Offset and Length values of the primary key.

      For example, if the key is going to be the first 3 bytes of the record, specify Offset:0, Length:3.

    5. To create a split key, click GUID-AF5B3CAC-8C5F-4E1B-BA3A-9D26E1C1C650-low.png (Insert After), select the new component and specify the key values.
      Tip: To delete a component, select it, then click GUID-26BED381-24DF-4773-ADAC-4A909F54873F-low.png (Delete).
    6. Click OK.

      The primary key is created.

  9. If required, add an alternate key:
    1. Click Define Keys.
    2. In the Key section, click GUID-AF5B3CAC-8C5F-4E1B-BA3A-9D26E1C1C650-low.png (Insert Before).

      An Alt Key <number> key is created, with a default component.

    3. In the Options section, select the appropriate check boxes:
      Allow duplicates
      Allows duplicate values for this key.
      Sparse
      Allows you to define an ANSI or EBCDIC value that when used as the value of this key, will not be stored in the index file; thus saving space.
    4. In the Compression section, select the appropriate check boxes:
      Leading spaces
      Removes the leading spaces within the value of the key.
      Trailing spaces
      Removes the trailing spaces within the value of the key.
      Duplicates
      For alternate keys only. Only the first duplicate key is contained in the file; subsequent duplicate values are not stored, but information is stored to enable correct recreation of the keys.
    5. Click the Component tab.

      Details for the default component, created when the key was added, appear.

    6. Select the Alt Key, then specify the Offset and Length values.

      For example, if the key is going to be the next 3 bytes of the record after the primary key, specify Offset:3, Length:3.

    7. To create a split key, click GUID-AF5B3CAC-8C5F-4E1B-BA3A-9D26E1C1C650-low.png (Insert After), select the new component and specify the key values.
      Tip: To delete a component, select it, then click GUID-26BED381-24DF-4773-ADAC-4A909F54873F-low.png (Delete).
    8. Click OK. The alternate key is created.
  10. Click GUID-1E3884E8-1DFD-4408-A21D-2D5ED6DEA450-low.png beside Encoding, then select either ANSI or EBCDIC.
    Note: Once the file is created and open in the editor, you can switch between the two encodings.
  11. If the records will be of variable length, select Variable length records.
  12. Specify the Min Length (only applicable for variable length records), and Max Length values. All the details you specify in the File Details section are written to the file header of the indexed file.
  13. Click Create File.

    The file is created, then opened in the editor.