Values for length and precision

Values for the length and precision attributes are different for different data types.

The following table lists each data type with a description of the possible values for length and precision.

Data type Length Precision
type="char" The number of bytes of data for this element, which is not necessarily the number of characters. You must specify either a literal number or a data-name. Not applicable
type="int" The number of bytes of data for this element: 2, 4, or 8. You must specify a literal number.

Indicates the number of bits of precision and whether the integer is signed or unsigned:

  • For length="2"
    • Use precision="15" for a signed 2-byte integer. This is the default value
    • Use precision="16" for an unsigned 2-byte integer
  • For length="4"
    • Use precision="31" for a signed 4-byte integer
    • Use precision="32" for an unsigned 4-byte integer
  • For length="8" use precision="63" for a signed 8-byte integer
type="packed" or "zoned" The number of numeric digits of data for this element. You must specify a literal number. The number of decimal digits for the element. This number must be greater than or equal to zero and less than or equal to the total number of digits specified on the length attribute.
type="float" The number of bytes, 4 or 8, of data for this element. You must specify a literal number. Not applicable
type="byte" The number of bytes of data for this element. You must specify either a literal number or data-name. Not applicable
type="struct" Not allowed. Not applicable

Resolving relative names

Several attributes allow you to specify the name of another element, or tag, within the document as the attribute value. The name specified can be a name that is relative to the current tag.

Names are resolved by seeing if the name can be resolved as a child or descendent of the tag containing the current tag. If the name cannot be resolved at this level, the search continues with the next highest containing tag. This resolution must eventually result in a match of a tag that is contained by either the <pcml> tag or the <rfml> tag, in which case the name is considered to be an absolute name, not a relative name.

Here is an example using PCML:

<pcml version="1.0">
  <program name="polytest" path="/QSYS.lib/MYLIB.lib/POLYTEST.pgm">
    <!-- Parameter 1 contains a count of polygons along with an array of polygons -->
    <struct name="parm1" usage="inputoutput">
      <data name="nbrPolygons" type="int" length="4" init="5" />
      <!-- Each polygon contains a count of the number of points along with an array of points -->
      <struct name="polygon" count="nbrPolygons">
        <data name="nbrPoints" type="int" length="4" init="3" />
        <struct name="point" count="nbrPoints" >
          <data name="x" type="int" length="4" init="100" />
          <data name="y" type="int" length="4" init="200" />
        </struct>
      </struct>
    </struct>
  </program>
</pcml>

Here is an example using RFML:

<rfml version="4.0">
  <struct name="polygon">
    <!-- Each polygon contains a count of the number of points along with an array of points. -->
    <data name="nbrPoints" type="int" length="4" init="3" />
    <data name="point" type="struct" struct="point" count="nbrPoints" />
  </struct>
  <struct name="point" >
    <data name="x" type="int" length="4" init="100" />
    <data name="y" type="int" length="4" init="200" />
  </struct>
  <recordformat name="polytest">
    <!-- This format contains a count of polygons along with an array of polygons -->
    <data name="nbrPolygons" type="int" length="4" init="5" />
    <data name="polygon" type="struct" struct="polygon" count="nbrPolygons" />
  </recordformat>
</rfml>