Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Checksum of FIX message

Status
Not open for further replies.

WP

Programmer
Nov 30, 1999
463
CH
Hi,

Has anyone got sample RPG code that works out the checksum of a string?

What code should do:
- take the FIX message stream (string)

- loop through each byte (character):
1) determine the integer value of that byte (e.g. 'A'=65, 'a'=97, '.'=46, note will be <= 256)
2) 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)



WP

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top