pjs.lookupLE()



This API allows you to find an array element which is less than or equal to the argument you pass to it.

An optional resulting indicators object can specify if any elements in the flags array should be set. The resulting indicators object can have these properties:

  • equal (Number) - identifies the flag number to set if an exact match is found

  • low (Number) - identifies the flag number to set if the nearest lower entry is found

Parameters
  1. Search argument

  2. Array

  3. Start index (OR resulting indicators object)

  4. Resulting indicators object (optional)

Return Value

Returns 0 if no matching element is found; otherwise, the element index is returned.

Example
pjs.define("i", { type: 'integer', length: 3, decimals: 0 }); pjs.define("SRCHWD", { type: 'packed decimal', length: 2, decimals: 0 }); pjs.define("arr", { type: 'packed decimal', length: 2, decimals: 0, dim: 20, orderby: 'ASCEND' }); arr[1] = 12; arr[2] = 23; arr[3] = 54; arr[4] = 57; arr[5] = 89; arr[6] = 63; arr[7] = 29; arr[8] = 26; arr[9] = 73; arr[10] = 50; SRCHWD = 44; pjs.lookupLE(SRCHWD, arr, { low: 80, equal: 81 });


RPG Equivalent

%LOOKUPLE()