pjs.call()



This method calls a Profound.js module or an IBM i program.

Parameters

  1. (String) Profound.js module or IBM i program name. The name can be qualified with a directory (Profound.js module) or library (IBM i). If not qualified either the pathlist or IBM i job library list will be used to resolve the name. If a Profound.js module of the given name is not found on the local file system and the Profound.js Connector is configured, then the name is assumed to be an IBM i program name.

    --or--

    (Function) Function exported from a module loaded with pjs.require().

  • (Variable, optional) - One or more parameters. Parameters can be either primitive JavaScript values (i.e. String, Number, etc.) or parameter objects returned by pjs.parm() and pjs.refParm(). Field names can also be passed; these will automatically be wrapped by pjs.refParm() internally. pjs.parm() or pjs.refParm() must be used for all parameters to IBM i programs. Pass null to omit a parameter.

Exception Handling

An Error instance will be thrown with the following properties:

  • message - The IBM i message text.

  • error - The message id.

  • help - The message help text.



Examples

Call IBM i Program w/Input and Output Parameters
const input = 123; pjs.define("output", { type: 'packed decimal', length: 15, decimals: 2 }); pjs.call('mypgm', pjs.parm(input, { type: 'packed decimal', length: 7, decimals: 2 }), output);



RPG Equivalent 

CALL



Requirements

This API requires the Profound.js Connector module.