Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Version History

« Previous Version 3 Next »

This file object method will open the file so the script is able to manipulate records within the chosen file. If you manually open a file, make sure you have a following close when you're finished with the file.

getRecord will have the same functionality as the CHAIN operation code in RPG. You may also use 'file.chain()' with the same parameters as this method.

Parameters
  1. Array of keys. Get the next record by key. If the file has no keys, it will default to the RRN.
  2. Boolean noLock. If true, no lock will be created.
  3. String recordName. Record format name.
  4. (Optional) Data strucutre. If a DS is passed in, the recieved buffer from the file will be placed into the specified DS.

Return Value

None.

Exception Handling

If there is a problem creating the data area, an Error will be thrown with the following properties:

  • message - The IBM i message text.
  • error - The message id.
  • help - The message help text.
Examples
pjs.defineTable("productsp", { read: true, keyed: true, levelIds: [ '4AFA8C636F188' ] });
pjs.define("data", { type: 'char', length: 50, varying: true });
 
//Find a record by the key.
productsp.getRecord([101]);
 
//If the record has been found..
if (productsp.found()) {
  data = pjs.char(prid);
}
  • No labels