file.positionAfter()
Â
This method positions the file at the next record with a key or relative record number greater than that specified in the search argument.
Parameters
Search argument - A Number, String, or Array value specifying a relative record number, key value, or list of key values (array of Number/String). The special values pjs.HIGH_VALUE and pjs.LOW_VALUE can also be used.
Record format name (optional) - A String value specifying the record format name.
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
Position to end of file to read last record
pjs.defineTable("myfile", { keyed: true, read: true });
myfile.positionAfter(pjs.HIGH_VALUE);
myfile.fetchPrevious();
Â
Read all records with first and second keys equal to 100 and 200, in reverse sequence
pjs.defineTable("myfile", { keyed: true, read: true });
myfile.positionAfter([100, 200]);
myfile.fetchPreviousEqual([100, 200]);
while (!file.endOfData()) {Â
// Do something with record data here.
myfile.fetchPreviousEqual([100, 200]);
}
RPG Equivalent
SETGT
Requirements
This API requires the Profound.js Connector module.