Page tree
Skip to end of metadata
Go to start of metadata

This method retrieves the previous record from the file.

Parameters
  1. 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.
  2. Record format name (optional) - A String value specifying the record format name.
  3. Input data structure (optional) - A Profound.js data structure reference. If specified, the referenced data structure will be populated with the record data. If the data structure is not qualified, you must wrap the parameter with the pjs.ds() API.

Exception Handling

An Error instance will be thrown with the following properties:

  • message - The message text.
  • error - The message id.
  • help - The message help text.
Examples
Read last record from file
pjs.defineTable("myfile", { read: true });
myfile.positionTo(pjs.END);
myfile.fetchPrevious();
if (!myfile.endOfData())
  doSomething();
Read last record from file into data structure without locking record
pjs.defineTable("myfile", { read: true, qualified: true });
pjs.define("myds", { type: 'data structure', qualified: true, likerec: { intrecname: 'myfile.myrecfmt' }});
myfile.positionTo(pjs.END);
myfile.fetchPrevious(false, null, myds);
if (!myfile.endOfData())
  doSomething();

RPG Equivalent

READP

Requirements

This API requires the Profound.js Connector module.