sign in | join about | help | sitemap
Connecting Tech Pros Worldwide
sea's Avatar

checksum question


Question posted by: sea (Guest) on November 12th, 2005 06:25 AM
I understand that it is possible to test the integrity of data using
something called checksum? What exactly is this and how do I use it in
DB2? I've searched a lot of places but could not find an answer, hence
this question -- thank you very much for any help!
7 Answers Posted
Fan Ruo Xin's Avatar
Guest - n/a Posts
#2: Re: checksum question

checksum used by db2 server, not by the user, to check the data (index, ...)
page consistency. You can did some tests on Unix. Such as you have a testing
db, you can use dd command to write some gabage data to one data page. Then
you will meet checksum problem.

"sea" <sea_099@hotmail.com> wrote in message
news:f8c6e337.0402021148.4788287b@posting.google.c om...[color=blue]
> I understand that it is possible to test the integrity of data using
> something called checksum? What exactly is this and how do I use it in
> DB2? I've searched a lot of places but could not find an answer, hence
> this question -- thank you very much for any help![/color]


Blair Adamache's Avatar
Guest - n/a Posts
#3: Re: checksum question

You can add a generated column in the row based on the contents of other
rows (numeric values work better). Or, you can calculate functions
across the tables using AVG, SUM, MAX and MIN, and store these values in
other tables (or even in other database instances or on disk).

Checksum algorithms themselves are not specific to relational database -
they're very popular with barcodes. A search on checksum on google
should give you some ideas on how to calculate checksums. Implementing
one in DB2 is very simple with triggers or generated columns using
numeric data. Character data would have to be transformed into something
across which a mathematical function could be run (such as BIT data).

sea wrote:
[color=blue]
> I understand that it is possible to test the integrity of data using
> something called checksum? What exactly is this and how do I use it in
> DB2? I've searched a lot of places but could not find an answer, hence
> this question -- thank you very much for any help![/color]

PM \(pm3iinc-nospam\)'s Avatar
PM \(pm3iinc-nospam\) November 12th, 2005 06:26 AM
Guest - n/a Posts
#4: Re: checksum question


Use www.google.com and search for
modulus 10
or
luhn
ex: http://utopia.knoware.nl/users/epre...mbers/Luhn.html

This is just an example of a well know formula. (check digit)

The basic principle is to apply a math function to the data and get a
result.
If you reapply the same function, you should get the same number again.
(data considered the same/good/etc.)

Those functions are developped by mathematicians so that the event of a wong
positive is reduced.
The function may be developped for a fixed length data stream or variable
lenght...

Of course you can also build your own but you may get sub-optimal/reduced
validity checking.


PM

"sea" <sea_099@hotmail.com> a écrit dans le message de
news:f8c6e337.0402021148.4788287b@posting.google.c om...[color=blue]
> I understand that it is possible to test the integrity of data using
> something called checksum? What exactly is this and how do I use it in
> DB2? I've searched a lot of places but could not find an answer, hence
> this question -- thank you very much for any help![/color]


Blair Adamache's Avatar
Guest - n/a Posts
#5: Re: checksum question

Yes, checksums are used by DB2 internally at the physical (page) level
to ensure data integrity. But nothing prevents the DBA from creating
their own checksums at the logical level (row, column or table) to
ensure that data integrity isn't damaged by an application error.

Check constraints and NOT NULL are very basic ways of doing this (i.e.
ensure every employee makes at least the minimum wage of $nn,nnnn per
year or every employee is either male or female). I think Sea wants
something more sophisticated - i.e. if the state in someone's address is
Texas, the phone number and zipcode must be values that are possible in
Texas.

Fan Ruo Xin wrote:
[color=blue]
> checksum used by db2 server, not by the user, to check the data (index, ...)
> page consistency. You can did some tests on Unix. Such as you have a testing
> db, you can use dd command to write some gabage data to one data page. Then
> you will meet checksum problem.
>
> "sea" <sea_099@hotmail.com> wrote in message
> news:f8c6e337.0402021148.4788287b@posting.google.c om...
>[color=green]
>>I understand that it is possible to test the integrity of data using
>>something called checksum? What exactly is this and how do I use it in
>>DB2? I've searched a lot of places but could not find an answer, hence
>>this question -- thank you very much for any help![/color]
>
>
>[/color]

Mark A's Avatar
Guest - n/a Posts
#6: Re: checksum question

"Blair Adamache" <badamache@2muchspam.yahoo.com> wrote in message
news:bvn795$dbt$1@hanover.torolab.ibm.com...[color=blue]
> You can add a generated column in the row based on the contents of other
> rows (numeric values work better). Or, you can calculate functions
> across the tables using AVG, SUM, MAX and MIN, and store these values in
> other tables (or even in other database instances or on disk).
>
> Checksum algorithms themselves are not specific to relational database -
> they're very popular with barcodes. A search on checksum on google
> should give you some ideas on how to calculate checksums. Implementing
> one in DB2 is very simple with triggers or generated columns using
> numeric data. Character data would have to be transformed into something
> across which a mathematical function could be run (such as BIT data).
>[/color]
Checksums are usually applied to an entire file to test the integrity of the
file.

A check digit is a digit added on the end of a number (customer number,
invoice number, etc) that reduces the likelihood of transposition errors
when copying the number. A check digit can eliminate 100% of single
transposition errors and sometimes 100% of double transposition errors
(depending on which modulus is used). A transposition error is defined as
copying 54 when it should have been 45. Check digits always eliminate 90%
of random errors (copying 47 when it should have been 45). Check digits have
been used since long before barcodes came into existence.


sea's Avatar
Guest - n/a Posts
#7: Re: checksum question

Thank you all so very much for all explanations and ideas about
checksum, a subject I had no idea about to begin with! Thank you for
your time and efforts!

================================================== ======================


"PM \(pm3iinc-nospam\)" <PM(pm3iinc-nospam)@sympatico.ca> wrote in message news:<gaFTb.2831$ZN1.211079@news20.bellglobal.com>...[color=blue]
> Use www.google.com and search for
> modulus 10
> or
> luhn
> ex: http://utopia.knoware.nl/users/epre...mbers/Luhn.html
>
> This is just an example of a well know formula. (check digit)
>
> The basic principle is to apply a math function to the data and get a
> result.
> If you reapply the same function, you should get the same number again.
> (data considered the same/good/etc.)
>
> Those functions are developped by mathematicians so that the event of a wong
> positive is reduced.
> The function may be developped for a fixed length data stream or variable
> lenght...
>
> Of course you can also build your own but you may get sub-optimal/reduced
> validity checking.
>
>
> PM
>
> "sea" <sea_099@hotmail.com> a écrit dans le message de
> news:f8c6e337.0402021148.4788287b@posting.google.c om...[color=green]
> > I understand that it is possible to test the integrity of data using
> > something called checksum? What exactly is this and how do I use it in
> > DB2? I've searched a lot of places but could not find an answer, hence
> > this question -- thank you very much for any help![/color][/color]
Blair Adamache's Avatar
Guest - n/a Posts
#8: Re: checksum question

There is a modulus function in DB2, called MOD. It could be used in a
generated column to automatically produce a checkdigit as follows:

CREATE TABLE employeex (name VARCHAR(10),
salary dec(10,2),
mod_sal generated always as (mod(int(salary),7)))

sea wrote:
[color=blue]
> Thank you all so very much for all explanations and ideas about
> checksum, a subject I had no idea about to begin with! Thank you for
> your time and efforts!
>
> ================================================== ======================
>
>
> "PM \(pm3iinc-nospam\)" <PM(pm3iinc-nospam)@sympatico.ca> wrote in message news:<gaFTb.2831$ZN1.211079@news20.bellglobal.com>...
>[color=green]
>>Use www.google.com and search for
>>modulus 10
>>or
>>luhn
>>ex: http://utopia.knoware.nl/users/epre...mbers/Luhn.html
>>
>>This is just an example of a well know formula. (check digit)
>>
>>The basic principle is to apply a math function to the data and get a
>>result.
>>If you reapply the same function, you should get the same number again.
>>(data considered the same/good/etc.)
>>
>>Those functions are developped by mathematicians so that the event of a wong
>>positive is reduced.
>>The function may be developped for a fixed length data stream or variable
>>lenght...
>>
>>Of course you can also build your own but you may get sub-optimal/reduced
>>validity checking.
>>
>>
>>PM
>>
>>"sea" <sea_099@hotmail.com> a écrit dans le message de
>>news:f8c6e337.0402021148.4788287b@posting.google.c om...
>>[color=darkred]
>>>I understand that it is possible to test the integrity of data using
>>>something called checksum? What exactly is this and how do I use it in
>>>DB2? I've searched a lot of places but could not find an answer, hence
>>>this question -- thank you very much for any help![/color][/color][/color]

 
Not the answer you were looking for? Post your question . . .
196,847 members ready to help you find a solution.
Join Bytes.com

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 196,847 network members.
Post your question now . . .
It's fast and it's free

Popular Articles

Top Community Contributors