Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Version History

« Previous Version 6 Next »

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, including 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 can wait for the programs 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 pjs.call() API. For example:

pjs.call("PROGRAM");

 

Parameters

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
pjs.call("CUST01R", customerId, mode);

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

  • No labels