Imported from previous forum
[ original email was from Mikhail Stotland - m5373@hotmail.com ]
Hi,
I would like to ask you about something what I have a problem with, I am
working on the FIX protocol 4.0 and I have to calculate a CheckSum(field
10), I found code in C++, and I am VB programmer. I would really appreciate
if you could help me with it.
Thank you.
I’m not a Visual Basic person. I assume you are reviewing Appendix B - CheckSum Calculation which provides a C language sample code fragment. VB may even have a built-in checksum method/function.
What this code does is:
-
take the FIX message stream (string)
-
loop through each byte (character):
- determine the integer value of that byte (e.g. ‘A’=65, ‘a’=97, ‘.’=46, note will be <= 256)
- accumulate (continue to add values to a variable) the integer value of that byte to a variable in order to obtain the sum of the integer value of each byte in the FIX message stream
-
compute the modulus (integer of the remainder following division also known as "mod" (C/C++ and Java use "%" for this)) of the sum obtained above when divided by 256
-
take the modulus integer value (will always be less than 256 since it was mod’d by 256) and represent it as a 3 character sting with leading zeros if necessary
-
use the above 3 character string as the value for Checksum (tag 10)
Hope that helps.
> Hi,
> I would like to ask you about something what I have a problem with, I am
> working on the FIX protocol 4.0 and I have to calculate a CheckSum(field
> 10), I found code in C++, and I am VB programmer. I would really appreciate
> if you could help me with it.
> Thank you.
>