InterSystems IRIS Data Platform 2019.2  /  ObjectScript Reference

ObjectScript Reference
Previous section           Next section
InterSystems: The power behind what matters   

Cyclical-redundancy check for data integrity.
string A string.
$ZCYC(string) computes and returns the cyclical-redundancy check value for the string. It allows two intercommunicating programs to check for data integrity.
The sending program transmits a piece of data along with a matching check value that it calculates using $ZCYC. The receiving program verifies the transmitted data by using $ZCYC to calculate its check value. If the two check values match, the received data is the same as the sent data.
$ZCYC calculates the check value by performing an exclusive OR (XOR) on the binary representations of all the characters in the string.
Note that the $ZCYC value of an 8-bit string is identical to the $ZCRC mode 1 value.
A string. Can be specified as a value, a variable, or an expression. String values are enclosed in quotation marks.
In this example, the first $ZCYC returns 65; the second returns 3; and the third returns 64.
   SET x= $ZCYC("A") 
      ; 1000001 (only one character; no XOR )
   SET y= $ZCYC("AB") 
      ; 1000001 XOR 1000010 -> 0000011
   SET z= $ZCYC("ABC") 
      ; 1000001 XOR 1000010 -> 0000011 | 1000011 -> 100000
   WRITE !,"x=",x," y=",y," z=",z
See Also

Previous section           Next section
Send us comments on this page
View this book as PDF   |  Download all PDFs
Copyright © 1997-2019 InterSystems Corporation, Cambridge, MA
Content Date/Time: 2019-08-20 05:45:45