Skip to end of metadata
Go to start of metadata

This API defines a JavaScript function that maps to an external procedure in an IBM i service program, similar to a prototype in an ILE program.

If a function by the same name is already exported by pjs.requireServiceProgram() or pjs.requireModule() API, the call to pjs.defineProc() will have no effect, and the exported functions will be utilized instead of the external procedure specified by pjs.defineProc().

Parameters

  1. Function name - A String that specifies the name of the JavaScript function to create within the current scope
  2. Configuration - an object with the following properties:
    • srvpgm (optional) - A String containing the name of the service program to use. The service program name can be quailed with a library, otherwise the library list will be used to resolve the service program. If the service program is not specified, the API will attempt to resolve the procedure automatically.
    • extProc (optional) - A string containing the name of the external procedure in the service program. If not specified, the procedure name is assumed to be the same as the Function name.
    • parms - An array of parameter definitions. Each parameter definition is a configuration object of the format used by pjs.define(). Optionally, you can attach a name property to the configuration objects to identify parameter names; however, the name is for informational purposes only and is not used internally by the API. Each configuration object may also contain a byRef true or false property, which specifies whether the parameter is passed by reference. The default value for byRef is false. pjs.refParm() must be used when calling the function and passing parameters by reference.
    • result (optional) - A configuration object of the format used by pjs.define(), which defines the procedure's return value. This property should only be specified if the procedure has a return value.

Examples

Calling a System API
Calling a procedure in your own service program
Passing parameters by reference


Requirements

This API requires the Profound.js Connector module.

Labels
  • No labels