pjs.getDataArea()



This API retrieves data from an IBM i data area, starting at the first position and ending at the given length.

Parameters

  1. name - A string containing the data area name, in LIBRARY/OBJECT_NAME notation. If the library is omitted the, job's library list will be used to resolve the data area. The special values "*LDA", "*GDA", and "*PDA" can also be used.

  2. length - The desired length of data to retrieve, in bytes.

  3. lock (optional) - If Boolean true is passed, the data area will be locked after the data is retrieved.

Return Value

A Buffer instance containing the data, in internal IBM i format. Decimal values are zoned, characters are encoded in the job's CCSID.

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



Read 10 bytes from the local data area
try { var buffer = pjs.getDataArea("*LDA", 10); } catch (error) { // Problem! Data not retrieved. }



RPG Equivalent

IN



Requirements

This API requires the Profound.js Connector module.