Key Section

The key section contains an entry for each key in the file. The following example refers to the SELECT cited in the previous section, and shows the key information in a simple text format:

# [Key Section]
01,0,005,0000000000
01
CL-CLIENT-ID
02,1,015,0000000005,015,0000000020
02
CL-FIRST-NAME
CL-LAST-NAME

For each key, there is a line describing the number of segments in the key, whether or not the key allows duplicates, and the size and offset for each segment in the key. Segment size and offset are repeated as necessary to describe each segment in the key.

In the example given, the primary key (CL-CLIENT-ID), is defined as having one segment and being a unique key (01,0). The size of the segment is 5 (005), and the offset is 0.

The alternate key is defined as having two segments and allowing alternates (02,1). The first segment is described as having a size of 15 and an offset of 5; the second segment also has a size of 15, but its offset is 20.

The next line in each key description contains the number of elementary field definitions defined in the key. For the primary key in the example, there is one elementary field. In the alternate key, there are two.

The remaining lines in the key section give the name of each elementary field contained in the key.

In XML format, the key section appears as follows:

<xfd:keys>
  <xfd:key xfd:segment-count="1" xfd:duplicates-allowed="false">
    <xfd:segments>
      <xfd:segment xfd:segment-size="5" xfd:segment-offset="0"/>
    </xfd:segments>
    <xfd:key-columns xfd:key-column-count="1">
      <xfd:key-column xfd:key-column-name="CL-CLIENT-ID"/>
    </xfd:key-columns>
  </xfd:key>
  <xfd:key xfd:segment-count="2" xfd:duplicates-allowed="true">
    <xfd:segments>
      <xfd:segment xfd:segment-size="15" xfd:segment-offset="5"/>
      <xfd:segment xfd:segment-size="15" xfd:segment-offset="20"/>
    </xfd:segments>
    <xfd:key-columns xfd:key-column-count="2">
      <xfd:key-column xfd:key-column-name="CL-FIRST-NAME"/>
      <xfd:key-column xfd:key-column-name="CL-LAST-NAME"/>
    </xfd:key-columns>
  </xfd:key>
</xfd:keys>