Calling Node.js Modules via PJSCALL Program (*PGM object)





Note that this page refers to the program PJSCALL (*PGM object). For information on how to use the PJSCALL command (*CMD object), please refer to Calling Node.js Modules via PJSCALL Command. For an example of how to use the PJSCALL program as documented on this page, please see here.

PJSCALL Program (*PGM object)

You can call a module right from your existing RPG programs by using the included PJSCALL RPG program. 

It supports:

  • Calling of both the standard Profound.js instances as well as the www.profoundjs.com cloud spaces.

  • Sending and receiving RPG typed parameters

  • Calling specific modules and routines of that module

  • Calling the start module of a workspace

The program interface is as follows:

PJSCALL Parameter List

PJSCALL Parameter List



Parameter

Usage

Type/Length

Options

1

Parameter Type

This should always pass in the value of "*MODULE"

Input

Char(30)

Const

2

ModuleID

This is made up of workspace information as well as module file path.

Input

VarUSC2(500)

Const

3

Routine Name

If the module being called is a Low-Code Module, you can specify the exact routine to be called.

Input

VarUCS2(70)

Const

4

Input Parameter (optional)

Parameter to pass to the Low-Code module.
This should be a data structure which subfields matches exactly to a Low-Code module input parameters type and size.

Input

DataStructure

Const *Omit *NoPass

5

Input Parameter Size (optional)

The size of the Input Parameter data structure

Input

Int(10)

Const *Omit *NoPass

6

Output Parameter (optional)

Parameter to be returned from the Low-Code module.
This should be a data structure which subfields matches exactly to a Low-Code module output parameters type and size.

Output

DataStructure

Const *Omit *NoPass

7

Output Parameter Size (optional)

The size of the Output Parameter data structure

Input

Int(10)

Const *Omit *NoPass

Having the correct value for the ModuleID parameter is very important.  When creating a Low-Code module with the IDE, it has a separate tab that auto generates the exact RPG code snippet needed to call that module.  Here are the different use cases and example values:

  • RPG program calling a Low-Code module within a Workspace: "workspacename:file.module.json"

  • RPG program calling a Low-Code module within a subfolder of a Workspace: "workspacename:someFolder\file.module.json"

  • RPG program calling a Low-Code module within the modules folder not in a Workspace: "someFolder\file.module.json"

  • RPG program calling a Workspace start module: "workspacename"

  • RPG program calling a profoundjs.com space Low-Code module "spacename:spaceowner:file.module.json"

  • RPG program calling a profoundjs.com space start module "spacename:spaceowner"

  • RPG program calling a profoundjs.com space Low-Code module with an Access Token: "spacename:spaceowner:token:file.module.json"

Calling a low-code module from an RPG program

For more information about how to call a low-code module from an RPG program, please see Call Low-code Modules (under heading "From a RPG program"). To enable calling of low-code modules from RPG programs, configuration option showIBMiParmDefn must be set to "true".

For more information on how to set up Modules, please see Creating Callable Profound.js Modules or Creating Low-Code Modules.