Program Calls

Profound.js allows you to call any existing IBM i programs, including programs written in CL, RPG, COBOL, and C. You can even call interactive programs, such as programs that use a green-screen interface or programs that use RPG Open Access to display a Rich User Interface. When a green-screen program is called, the green-screen interface is converted to HTML5 on-the-fly. This capability is provided by Genie.

The calls will maintain a standard IBM i call stack. You can code these calls using a familiar top-down business programming paradigm, without having to code JavaScript asynchronous callbacks. Profound.js will wait for the called program to complete (even when a user interface is involved) without blocking the Node.js event loop. The call is then gracefully returned to Node.js processing. This capability is provided through Fibers.

Calls to programs are made using the API. For example:"PROGRAM");



Passing parameters is very simple with Profound.js because of support for Strongly typed fields. You can simply define a parameter field using the IBM i data type expected by the program you are calling. For example:

// Define Parameters
pjs.define("customerId", { type: "char", length: 8, initValue: "10000123" });
pjs.define("mode", { type: "char", length: 10, initValue: "DISPLAY" });
// Call Program"CUST01R", customerId, mode);

Parameters can be passed by reference (both input and output), meaning that the called program can change the values of fields defined within your Node.js code.