Skip to main content

Binary Flat Files

For interoperability with mainframes, it has been a requirement for Alteryx flat files to read flat files that contain binary fields. This is accomplished by extending the .flat XML file format for describing an input. This is .flat file version 2 and requires that version be set in the header. Because of the nature of binary fields, these extensions are not editable in the GUI field editor for flat files. There is no easy way to show binary fields.

There is a new XML tag within the field tag called translate. The output field type is still determined by the field tag. It's possible to specify output field types and input translations that aren't exactly compatible, like an output field type of int16 for a 9-character BCD field. The following types and attributes are valid within the translate tag:

  • BCD: Binary Coded Decimal

    • This results in an integer. The digits are stored in 4-bit nibbles left to right with the high 4 bits of each byte being the more significant digit.

    • The last nibble can optionally be a sign. Valid values are...

      • "C" hex is positive.

      • "D" hex is negative.

      • "F" hex is unsigned (effectively positive).

      Any other value results in a warning.

  • Integer: Binary Integer field.

    • The field length must be 1, 2, 4, or 8. Any other length results in an error.

    • Optional Attribute: ByteOrder:

      • LE or LittleEndian: Least Significant byte first. This is the default.

      • BE or BigEndian: Most Significant byte first.

    • Optional Attribute: Signed:

      • True (default) or False

    • Float:  Floating point binary field

      • The field length must be 4 or 8. Any other length results in an error.

    • Blob: Just read the data as binary. The field type is required to be a blob.

    • Text: Normal text data. This is the default if no translate tag is specified.

      • Attribute: CodePage: Specifies a Windows codepage number. The Default is 28591, ISO 8859-1 Latin I. For more, go to Code Pages.

Example flatfile XML File

	<fileeoltype="none"allowShortLines="f"allowLongLines="f"trimWhiteSpace="f" />
		<fieldname="Field_1"type="V_String"length="200" />
		<fieldname="Blank"type="V_String"length="1" />
		<fieldname="suppress key"type="V_String"length="15" />
		<fieldname="Blank2"type="V_String"length="4" />
		<fieldname="counter packed"type="Int32"length="9" >
		<fieldname="Blank3"type="V_String"length="1" />
		<fieldname="counter unsigned packed"type="Int32"length="9">
		<fieldname="Blank4"type="V_String"length="1" />
		<fieldname="counter binary"type="Int32"length="4">
		<fieldname="Blank5"type="V_String"length="6" />