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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Data integrity checksums

Status
Not open for further replies.

Piloria

IS-IT--Management
Mar 12, 2002
435
GB
Waht i am trying to acheve is create a record in file 1 on server A using java and process the record in a replica file on server B using Cobol
the transport between the two servers will be an through unsecure area.
idealy i would like to use some form of checksum algorithum on the file record which will be added to the record.

i therefore need some form of algorithm usable from cobol and java that can be contained within the code rather than a standalone program (for security)

File Type is DB2/400 on an AS400

Any help or even if you have some idea of where to start looking.
 
An internet search for "checksum" yields numerous potentially useful links. Some links offer source code.
Check these out:

In the meantime, you can develop the code on your own as follows.

First, lets agree on what we are trying to accomplish. Checksum or Check Sum has a number of definitions such as:

1. A count of 1's or 0's (bits) of a message (included in the message) that will allow the receiver to verify that the message is 'whole'.

2. A method of adding all bytes in a message and storing a value in the last byte; where the sum of all bytes (including the value you stored in the last byte) equals zero.

If you use the second definition, you will be converting each byte in your message to a numeric value. Note that while adding up all the bytes, the high order bit will be lost whenever the resulting sum cannot fit in the results byte - this is expected.

That also means that developing a foolproof checksum strategy is probably not possible. Several algorythms exist that purport to give you the best checking possible. Here is a heavy math model of such an algorythm:

There are many possible strategies that can be developed to accommodate both Java and Cobol. As for my second definition, should you decide to use it, your Cobol (and Java) must have the capability to translate the character set you are using into decimal, octal or hex.


Dimandja
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top