Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Returns the number of decimals within a variable declared field or constant.

Parameters:
  1. Variable Declared field or constant
Example:
Code Block
languagejavascript
  pjs.define("testnum", { type: 'packed decimal', length: 7, decimals: 3 });
 
pjs.define("result", { type: 'integer', length: 5, decimals: 0 });

testnum = 236.56;

result = pjs.decimalPositions(testnum);  // result is 3 because the field is strongly typed with 3 decimal positions
result = pjs.decimalPositions(236.56;

 53);  // result is 2
 
var x = 236.56;
result = pjs.decimalPositions(testnumx);  // result is 2; x is loosely typed

RPG Equivalent 

%DECPOS()