This function provides an easy way to clear a certain bit in a value. It does not access any I/O, but rather provides a much easier way to clear a bit than standard REXX functions do. The format of the function is:

return_value = RTBitClear( value, bit_position )

The value is in decimal with a range of 0 to 65535.

bit_position is the position of the bit which value is to be cleared. The right-most position (and therefore the least significant bit) is 0, the left-most (or most significant bit) position is 15.

return_value is the value returned after the bit has been cleared. Range is 0 to 65535.

There is no variable range checking, so you must insure that the right values are passed along in the function.

Example:

The code below illustrates the RTBitClear function.

SAY 'Clearing bit position 0 of the value 255 results in ' || RTBitClear( '255', '0' )
SAY 'Clearing bit position 1 of the value 65535 results in ' || RTBitClear( '65535', '1' )

Output:
Clearing bit position 0 of the value 255 results in 254
Clearing bit position 1 of the value 65535 results in 65533