pjs.dec()
The pjs.dec() API converts a value to a packed decimal number.
Parameters
Value / field
Total length (optional)
Decimal places - number of decimal place; does not add to the total length (optional)
Half-adjust - if true, the number will be half-adjusted or rounded (optional)
Examples
Example 1: char -> packed decimal
pjs.define("p1", { type: 'packed decimal', length: 5, decimals: 2 });
p1 = pjs.dec('123.45', 5, 2);
return p1;
//123.45
Example 2: date -> packed decimal
pjs.define("d1", { type: 'date', dateFormat: '*eur', initValue: pjs.date('2016-06-15') });
pjs.define("p1", { type: 'packed decimal', length: 10, decimals: 0 });
p1 = pjs.dec(d1);
return p1;
//15062016
RPG Equivalent
%DEC()
Some documentation pages have recently moved to a new section: Profound AppDev. If you are having trouble finding specific pages, try the documentation search capability or reach out to our Support team!