dbTalk Databases Forums  

Block Check

comp.databases.pick comp.databases.pick


Discuss Block Check in the comp.databases.pick forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
iakovos@gmail.com
 
Posts: n/a

Default Block Check - 05-19-2005 , 02:03 AM






Would anyone care to tell me the formula on how to calculate a BCC
(Block-check) on a string? In mve Pick there's a user-exit that does it
but I don't know the formula. Searching on google I found that I need
to do an XOR on each character of the string, but the bit XOR I know
requires two chars (one a constant?)...


Reply With Quote
  #2  
Old   
stope19
 
Posts: n/a

Default Re: Block Check - 05-19-2005 , 03:54 AM







<iakovos (AT) gmail (DOT) com> wrote

Quote:
Would anyone care to tell me the formula on how to calculate a BCC
(Block-check) on a string? In mve Pick there's a user-exit that does it
but I don't know the formula. Searching on google I found that I need
to do an XOR on each character of the string, but the bit XOR I know
requires two chars (one a constant?)...

Are you sure about the XOR requirement? I thought a 'block check' (at least
in comms) was just the modulo 256 sum of all the characters in the message.
The mod 256 is done to extract the least significant byte. The result would
normally be displayed as two hex digits. So... The string "ABCDE" would be:
65 + 66 + 67 + 68 + 69 = 335, so the BCC is MOD(335, 256) = 79 (or 4F in
hex)
Of course, I may be way out on this ...





Reply With Quote
  #3  
Old   
Luke Webber
 
Posts: n/a

Default Re: Block Check - 05-19-2005 , 06:07 AM



iakovos (AT) gmail (DOT) com wrote:
Quote:
Would anyone care to tell me the formula on how to calculate a BCC
(Block-check) on a string? In mve Pick there's a user-exit that does it
but I don't know the formula. Searching on google I found that I need
to do an XOR on each character of the string, but the bit XOR I know
requires two chars (one a constant?)...
Which flavour of Pick? I've never seen a BITXOR that required either
argument to be a constant.

BTW, a more specific term than BCC is LRC (Longitudinal Redundancy
Check). BCC is a fairly generic term.

Luke


Reply With Quote
  #4  
Old   
Tom Pellitieri
 
Posts: n/a

Default Re: Block Check - 05-19-2005 , 08:32 AM



BCC is one of many types of check-sums. Typically, one would transmit
a string and its checksum to another computer. The receiving computer
would recalculate the checksum. If they don't match, you know there's
a transmission error.

To calculate the BCC, you need to XOR every byte in the string
sequentially. Something like this:

BCC = 0
FOR I = 1 TO LEN(STR)
BCC = BITXOR(BCC,STR[I,1])
NEXT I

BCC should then match the reported BCC. If the BCC was reported as a
hex number, you'll need to convert.

--Tom Pellitieri
--Tom Pellitieri


Reply With Quote
  #5  
Old   
iakovos@gmail.com
 
Posts: n/a

Default Re: Block Check - 05-19-2005 , 06:04 PM



Thanks Tom and everyone else who tried to help me.
The formula can be achieved with this bit of code. Slightly changed
from Tom's suggestion:

B = 0
FOR I = 1 TO LEN(STRING)
B = BITXOR(B,SEQ(STRING[I,1]))
NEXT I
B = DTX(B)

thanks again, problem solved

NB - Luke the Pick flavor is mve (or mventerprise)


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.