pjs.getInt()



The pjs.getInt() API interprets the contents of a strongly typed character field as a signed binary integer. 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
  1. 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.

  2. 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.

  3. Length (optional): Can be 2 or 4. An error is thrown if the starting position + length exceeds the length of the field.

Example
Example 1: 
pjs.define("int16", { type: 'char', length: 2 }); // Program call assigns binary integer value to field. pjs.call("example", int16); if (pjs.getInt(int16) === 1) { // Do something. }
Example 2: 
pjs.define("p1", { type: 'char', length: 10 }); // Program call assigns binary integer into last 4 positions of field. pjs.call("example", p1); if (pjs.getInt(p1, 7, 4) === 1) { // Do something. }



RPG Equivalent

None

CL Equivalent

%BINARY() / %BIN()