unfortunately the thoughts are a bit misplaced
the ts posted the requirement and snippets in different languages that build the required buffer
click on the link to the zabbix manual page
the Rexx snippets build the buffer according to the specifications
to be sure I run the bash snippets and the result agree
it looks strange with the code tags because to deal with bit/hex chars in other language you have to escape them
the only thing to check id the sequence of the socket commands used for the conversation