This method fetches the record specified by the search argument from the file.
Parameters
- Search argument - A Number, String, or Array of keys or key variable. Get the next record by key. If the file has no keys, it will default to the RRN.
- Boolean noLock. If true, no lock will be created. False by default.
- String recordName. Record format name.
- (Optional) Data structure. If a DS is passed in, the received buffer from the file will be placed into the specified DSvalue specifying a relative record number, key value, or list of key values (array of Number/String).
- Don't lock (optional) - Pass Boolean true to avoid locking the record if the file is open for update/delete. If this parameter is set to Boolean false or omitted records will be locked for update/delete files.
- Record format name (optional) - A String value specifying the record format name.
- Input data structure (optional) - A Profound.js data structure reference. If specified, the referenced data structure will be populated with the record data.
Exception Handling
An Error instance will be thrown with the following properties:
- message - The IBM i message text.
- error - The message id.
- help - The message help text.
...
Example
Code Block | ||||
---|---|---|---|---|
| ||||
pjs.defineTable("productspmyfile", { read: true, keyed: true, levelIds: [ '4AFA8C636F188' ] }); pjs.define("data", { type: 'char', length: 50, varying: read: true }); //Find a record by the key. productsp.myfile.getRecord([101]); //If the record has been found.. if (productspmyfile.found()) { data = pjs.char(prid); }doSomething(); |
RPG Equivalent
CHAIN