BITLOAD Function

Assigns values to the entire bit table or retrieves the current value of the entire table.

Syntax

BITLOAD({bitString})

Syntax Elements

bitString An ASCII string containing the characters 0 to 9 and A to F, representing a hexadecimal value. This is used as a bit pattern to assign values to the table from left to right, where each character represents a group of four bits. Assignment stops at the end of the string, after 32 characters or when a non-hexadecimal character is encountered.

If the string defines fewer than 128 bits, the remaining bits in the table are reset.

If bitString is supplied and does not evaluate to null, BITLOAD returns 0.

If bitString is omitted or evaluates to null, an ASCII hexadecimal character string is returned, representing the current bit settings from the table. Trailing zeros in the string are omitted.

Comments

BITLOAD operates on a table of 128 bits, numbered 1 to 128, unique to each process. Each bit is available as a two-state flag, that is, the value returned by the function is always either zero or one.

See Also

BITCHANGE function, BITCHECK function, BITRESET function, BITSET function.

Example 1

X = "AB233FA22AD498BA12348A"
A = BITLOAD(X)

Loads the bit table with the value of ASCII hex string X. After execution, the contents of the bit table are:

1010  1011  0010  0011  0011  1111  1010  0010
0010  1010  1101  0100  1001  1000  1011  1010
0001  0010  0011  0100  1000  1010  0000  0000
0000  0000  0000  0000  0000  0000  0000  0000

Note the remaining zeros (reset bits). Only 88 of the 128 bits were set because only 22 characters were contained in the input expression.

Example 2

TABLE = BITLOAD()

Loads variable TABLE with the hexadecimal value of the bit table.

Example 3

* Set the bits in the table to some initial values.
INIT = "B37A"
BITS = BITLOAD(INIT)
* Display their values.
PRINT BITLOAD()
* Set bit 2.
BIT2 = BITSET(2)
* Display the old and new values.
PRINT "Bit 2: ":BIT2:" ":BITCHECK(2)
* Clear bit 8.
BIT8 = BITRESET(8)
PRINT "Bit 8: ":BIT8:" ":BITCHECK(8)
* Change the value of bit 12.
BIT12 = BITCHANGE(12)
PRINT "Bit 12: ":BIT12:" ":BITCHECK(12)
* Display the modified table.
PRINT BITLOAD()

This example loads a bit pattern into the bit table, changes the values of some of the bits and displays their old and new values, and then displays the modified table as a hexadecimal string. When this example is executed, the following is displayed:

B37A
Bit 2: 0 1
Bit 8: 1 0
Bit 12: 1 0
F26A