array.lookupGT()



The lookupGT() method finds an element in a simple array or a data structure array that is greater than the argument provided.

Parameters
  1. Argument - value to search for

  2. Start Index - position to start searching from

  3. Element Count - number of elements to search from the starting position

  4. Subfield (optional) - if searching a data structure array, specifies which subfield should the function look up

Return Value

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

Example
pjs.define("NumIndex", { type: 'unsigned integer', length: 3, decimals: 0 }); pjs.define("arr", { type: 'char', length: 15, dim: 10, orderby: 'ASCEND' }); arr[1] = 'Cornwall'; arr[2] = 'kingston'; arr[3] = 'Dayton'; arr[4] = 'Paris'; arr[5] = 'Scarborough'; arr[6] = 'York'; arr[7] = 'Columbus'; arr[8] = 'London'; arr[9] = 'centerville'; arr[10] = 'vasad'; NumIndex = arr.lookupGT('Chicago', 3, 8);

RPG Equivalent

%LOOKUPGT()