pjs.setInt()
The pjs.setInt() API sets the contents of a strongly typed character field to a signed binary integer value. This API is provided to facilitate conversion of IBM i CL programs to Profound.js.
This API was added in Profound.js 5.8.0
Parameters
Field name: The name of a character field defined with pjs.define(). The field length must be 2 or 4, unless the start position and length parameters are passed.
Value: A numeric value to set. Decimal values will be converted to integer by dropping the fractional amount.
Starting position (optional): An integer >=1 that specifies the starting position in the field. If the starting position is specified, then the length must be specified as 2 or 4.
Length (optional): Can be 2 or 4. An error is thrown if the starting position + length exceeds the length of the field.
Example
pjs.define("p", { type: "char", length: 100, initValue: "x".repeat(100) });
pjs.define("l", { type: "decimal", length: 5, decimals: 0 });
pjs.setInt(p, 99.99, 97, 4);
l = pjs.getInt(p, 97, 4);
console.log(l); // Output: 99
RPG Equivalent
None
CL Equivalent
%BINARY() / %BIN()