Lookup This API allows you to find an element which matches (or is close to) an argument you pass to the lookup function. This API will return the index of the value if it has found a match, otherwise it will return 0.
Parameters
- Search argument
- Array
- Start index (OR resulting indicators object)
- Resulting indicators object (can be nulloptional)
- Search type (optional) - String value of "LE", "LT". , "GE", or "GT" . Can be null.can specify a less than or equal to, a less than, a greater than or equal to, or a greater than search instead of an exact match search
Return Value
Function will return Returns 0 if no matching element has been is found; otherwise, otherwise it will return the element index is returned.
Example
Code Block | ||
---|---|---|
| ||
pjs.define("i", { type: 'integer', length: 3, decimals: 0 }); pjs.define("SRCHWD", { type: 'packed decimal', length: 2, decimals: 0 }); pjs.define("arr", { type: 'char', length: 15, dim: 10 }); arr[1] = 'Cornwall'; arr[2] = 'kingston'; arr[3] = 'London'; arr[4] = 'Paris'; arr[5] = 'Scarborough'; arr[6] = 'York'; arr[7] = 'Columbus'; arr[8] = 'Dayton'; arr[9] = 'centerville'; arr[10] = 'vasad'; SRCHWD = arr[6]; pjs.lookup(SRCHWD, arr, i, { equal: 26 }); |
...