pjs.testBit()



Compares bits identified in the parameter with the corresponding bits in a field name or value.

Parameters

  1. Bit numbers - A string value that specifies the bit numbers to test.

  2. Test value - A Profound.js field name or a hex value to test.

Return Value

An Object with the following Boolean properties:

  • hi - True if any bits are 0

  • lo - True if one or more bits are 1

  • eq - True if all bits are 1

Example

Test if bit 4 is on
pjs.define("bitfield", { type: 'char', length: 1, initValue: String.fromEbcdicHex('08')}); // Binary 0000 1000 // ^ Bit 4 var _rs = pjs.testBit('4', bitfield); if (_rs.eq) {   // Bit 4 is on... doSomething();   }  

RPG Equivalent

TESTB