...
Code Block | ||
---|---|---|
| ||
function app(firstName, lastName) { pjs.define("firstName", { type: 'char', length: 30, refParm: firstName }); pjs.define("lastName" , { type: 'char', length: 30, refParm: lastName }); let fullName = `${firstName.trim()} ${lastName.trim()}`; console.log(`fullName = ${fullName}`); } exports.run = app; exports.parms = [ { type: 'char', length: 30 }, // firstName { type: 'char', length: 30 } // lastName ]; |
- Note that this This is in the format of a "regular" (i.e. NOT low-code) PJS module. It's also NOT a module meant to be called as an Express Route (web service) as in the example here. It does NOT have the "req" and "res" parameters as in a module meant to be called as web service. Instead, it has zero or more "usual" parameters that you can pass to the module, either from another PJS module or from command PJSCALL.
- You can call this module from an IBMi green-screen, using the command PJSCALL. The green-screen session could be a Genie session, but it does NOT have to be. A Genie session is required only if the PJS module uses an RDF (Rich Display File).
- Note that weWe'll use command PJSCALL (*CMD object) to call this PJS module. It's NOT the program PJSCALL (*PGM object) that's used to call low-code modules. This could be a source of confusion. We'll clarify it further in a future tip.
- On your IBMi system, in a green-screen session, run the following command to direct the call to the PJS instance installed on your PC. Use the port number for that PJS instance; default is 8081 as used in this example.
...