Skip to content

GAP

Generate Odd Parity

This string function converts each byte in a 7-bit ASCII character string to 8-bit using the 8th bit as odd parity for the byte.

GAP (string-value [,ERR=line-ref|,ERC=error-code])
string-value
is any string.
line-ref
is the program line number or label to branch to if an error is produced by this function.
error-code
is a programmer-defined error code. Valid values are positive or negative whole numbers.

To generate odd parity, each byte is evaluated and a 1 or 0 is placed in the leftmost bit to maintain an odd number of 1’s in the byte.

Odd parity is used as a means of checking for errors in data transmission.

GAP ("A")

returns “A” (11000001) the odd parity form of “A” (01000001).

LET X$ = GAP ("ABC")

returns “ABC” (11000001 11000010 01000011), the odd parity form of “ABC” (01000001 01000010 01000011).

From the Thoroughbred Basic Language Reference, Volume II: F–Q, version 8.9.1. Open this page in the PDF