pjs.retrieveDataArea()



This API retrieves data from an IBM i data area into a local field.

Parameters

This API can accept an optional database connection definition object to select between multiple database connections. To select the database connection, call pjs.getDB() and pass the result as the first parameter, followed by the parameters documented below. If a database connection definition object is not passed, the default database connection is used.

  1. Field - Reference to a field that is declared with the 'dataArea' configuration option 

  2. Lock data area (Boolean, optional) - default value is false

Exception Handling

If there is a problem retrieving the data, 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.define("DAT", { type: 'char', length: 12, dataArea: 'DAT' });   pjs.retrieveDataArea(DAT, false);



*LDA Example
pjs.define("lda", { type: 'data structure', qualified: true, dataArea: '*LDA', elements: { "field1": { type: 'char', length: 1 }, "field2": { type: 'char', length: 3 }, } }); // setting the database to the IBMi const db = pjs.getDB("ibmi"); // Retrieve the lda dataarea pjs.retrieveDataArea(db,lda);



RPG Equivalent

IN



Requirements

This API requires the Profound.js Connector module.