POPCNT
POPCNT returns a FIXED BIN value holding in each byte the number of bits equal to 1 in the corresponding byte of x.
- x
- Expression.
x must have the attributes REAL FIXED BIN with a scale factor of zero.
The result has the same precision as x.
The result has the same (UN)SIGNED attribute as x.
See the following examples of using POPCNT:
POPCNT( ‘01020304’xn )
returns‘01010201’xn
.POPCNT( ‘05060708’xn )
returns'02020301'xn
.- If x has the attributes FIXED BIN(31),
ISRL(POPCNT(x)*’01010101’xn,24)
returns the number of bits equal to 1 inx
.
On z/OS, the POPCNT(x) built-in function requires an ARCH level of 9 or higher.