Sysex messages may or may not need a length.
According to the specification the length of a sysex message is only saved in SMF and never transmitted. In case a device needs a length in certain messages, then it is part of the device specific message but not part of the surrounding sysex frame. So the size comes *after* the device id, while in standard MIDI files it comes *before* it, right after F0.
I can imagine two reasons to require a length in a sysex message:
- Knowing the size in advance allows to allocate a buffer of the right size and/or disable parsing while receiving the message.
- When you want to encapsulate several variable length messages in one sysex block there must be a way to figure out to which message a byte belongs.
The length of a transmitted SysEx block is always determined by the closing F7 byte.