The following example selects reads records from a file table 50 rows at a time , into a primitive JavaScript object.:
Code Block | ||
---|---|---|
| ||
pjs.connect("*LOCAL"); var c1 = pjs.allocStmt(); pjsc1.executeDirect(c1, "selectSELECT prid, prname, prdesc fromFROM demolib/productsp orderORDER byBY prid", "c1"); var obj; if (SQLSTATEsqlstate == '00000') { obj = pjs.fetch(c1, 50); while (c1.hasMoreRows()) { whilevar (SQLSTATErecords == '00000') { c1.fetch(50); for (var i = 0; i < SQLERRD[3]c1.rowCount(); i++) { var record = console.log(objrecords[i]); } obj = pjs.fetch(c1, 50console.log(record); } } } pjsc1.close(c1); pjs.disconnect() |