Page tree
Skip to end of metadata
Go to start of metadata

PJSCALL Program

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

ParameterUsageType/LengthOptions
1

Parameter Type

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

InputChar(30)Const
2

ModuleID

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

InputVarUSC2(500)Const
3

Routine Name

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

InputVarUCS2(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

InputInt(10)Const *Omit *NoPass
6Output 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.

OutputDataStructureConst *Omit *NoPass
7

Output Parameter Size (optional)

The size of the Output Parameter data structure

InputInt(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"

PJSCALL Command

The PJSCALL command located within your Profound.js installation library allows you to directly call a Profound.js module from a Genie session.

Your Profound.js module must be stored as a .js file within a subdirectory of modules under your Profound.js installation directory. Each modules subdirectory is similar to an IBM i library. The Profound.js installation directory may or may not be on the same server as Genie. You can control which server Genie connects to by configuring environment variables within a Genie session.

Your library list should include libraries PROFOUNDUI and PROFOUNDJS or their equivalents if you installed Profound UI and Profound.js into non-default libraries.

PJSCALL takes the following parameters:

  • Module - Specifies the Profound.js module name to call (the .js extension can be omitted here)
  • Directory - Specifies the subdirectory of modules containing the Profound.js module to call. You can specify *PATHLIST to use the pathlist to search for the module – all directories in the Profound.js pathlist are searched until the first match is found. The pathlist is derived from the IBM i job's library list.
  • Parameters - One or more parameters can be specified to pass to the module. Note: Unlike the PJSCALL program, the PJSCALL command does not modify the data in CL variables that are passed as parameters.

The Node.js module you call may either present an interactive user interface or just perform back-end business logic, in which case control is immediately passed back to Genie after the Node.js script finishes executing.

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

  • No labels