Wouldn't you be better to do the string length calculation on the HMI, run the code as the data is entered, calculate the string length and put it in to the length byte on the PLC. Also Beijer used to have an option in their Siemens driver so that you could choose the standard string format or the Siemens string format. I tried iX for one job and hated it, I don't remember if the string format option was still in the driver.