I can build the function to check if the bit is turned on then if it is subtract the value. But in Perl I can negate a value and hoped that KiXtart supported that as well.

Work around:

;if $SPval & 128
; $SPval = $SPval - 128
;endif

In Perl I can:

$SPval = $SPval & ~128

where "~" is a bitwise negation operator. Off to the "Suggestions" forum.
_________________________
Home page: http://www.kixhelp.com/hb/