Calling Node.js Modules via PJSCALL Command

Calling Node.js Modules via PJSCALL Command

This page refers to the command PJSCALL (*CMD object). For information on how to use the PJSCALL program (*PGM object), refer to Calling Node.js Modules via PJSCALL Program (*PGM object). For an example of how to use the PJSCALL command as documented on this page, see Tip 7: How to use commands PJSMYIP and PJSCALL to call a "regular" PJS module on your PC from IBMi system.

Overview

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 the libraries PROFOUNDUI and PROFOUNDJS, or their equivalents if you installed Profound UI and Profound.js into non-default libraries.

Command Parameters

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.

Unlike the PJSCALL program, the PJSCALL command does not modify the data in CL variables that are passed as parameters.

Behavior

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, see Creating Callable Profound.js Modules or Creating Low-Code Modules.