ZagTrader

FIX Protocol Tag 9: BodyLength

Length of the message body in bytes, counted from the first byte after the BodyLength field and its delimiter up to and including the delimiter before CheckSum (10). It is always the second field of a message.

Tag number
9
Data type
LENGTH
FIX versions
FIX 4.0 to 5.0 SP2 and FIXT 1.1
Location
Standard header

Practical notes on BodyLength

BodyLength is the number of bytes in the message after the BodyLength field, up to and including the SOH before CheckSum (10). It is always the second field.

  • The receiver uses it to cut the message out of the TCP stream, so it must be exact.
  • It counts bytes, not characters. Each SOH delimiter is one byte. Fields 8, 9 and 10 are not included.
  • A message with a wrong BodyLength is treated as garbled: it is dropped without a Reject and its sequence number is not consumed.

Common mistakes

  • Counting characters instead of UTF-8 bytes when free text contains non-ASCII characters.
  • Changing any field after computing the length, for example adding PossDupFlag on a replay.

See also:Incorrect BodyLength

Tag 9 in each FIX version

Values and message usage as defined in a specific version.

Data type

LENGTH: A positive integer giving a length in bytes, usually of the data field that follows.

Example

9=178

Illustrative value. In a message, fields are separated by the SOH character (0x01), often shown as | or ^ in logs.

Decode a message with this tag

Message types that use tag 9

BodyLength belongs to the standard message header, which every FIX message carries, so it is not listed against individual message types.

Field and message data comes from the QuickFIX data dictionaries for FIX 4.0 to 5.0 SP2 and FIXT 1.1, used under the QuickFIX Software License. This product includes software developed by quickfixengine.org (http://www.quickfixengine.org/). Enumerated value names are converted to plain text for reading.