views:

389

answers:

1

How can this code be converted to COBOL?

Result := GetSysColor(Color and $000000FF)

The value types are DWORD, I guess it is a bitwise operation.

+4  A: 

Yes, it's a bitwise operation, however, this specifically operation is equivalent to

COMPUTE Result = Color mod 256.

Or

COMPUTE Result = MOD(Color, 256).

If I remember my COBOL correctly. It has been decades years since I worte a line of COBOL.

Paulo Santos
shouldn't that be mod 256?
dummzeuch
Definitely. Fixing ...
gabr
Thanks... I completely forgot to carry one. :-\
Paulo Santos
The COBOL 85 standard has no mod operator. Use the MOD function instead with RESULT = MOD(Color,256)
Paul Morgan
Thanks, Morgan. Added variant.
Paulo Santos