The following example selects records from a file 50 rows at a time, into a primitive object.
pjs.connect("*LOCAL"); var c1 = pjs.allocStmt(); pjs.executeDirect(c1, "select prid, prname, prdesc from demolib/productsp order by prid", "c1"); var obj; if (SQLSTATE == '00000') { while (pjs.hasMoreRows(c1)) { obj = pjs.fetch(c1, 50); for (var i = 0; i < pjs.rowCount(c1); i++) { console.log(obj[i]); } } } pjs.close(c1); pjs.disconnect()