Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.


Note
titleContent Freeze

As of July 25th, 2023, there is a content freeze on this page.

This method is used to call an ILE procedure using Profound.js fields as arguments.

...

  • message - The IBM i message text.
  • error - The message id.
  • help - The message help text.

...


Examples

Code Block
languagejavascript
titleCall an RPG subprocedure with a parameter and a return value
function getPrice(item) {
  pjs.define("item", { type: "packed decimal", length: 7, decimals: 0, parm: item });
  pjs.define("price", { type: "packed decimal", length: 9, decimals: 2 });
 
  pjs.callProc({
    srvpgm: "PGMLIB/SALESORDER",
    procedure: "GETPRICE",
    arguments: [
      { field: "item" }
    ],
    result: "price"
  });
  return price;
}
 
var price = getPrice(1234);

...

Code Block
languagejavascript
titleCall subprocedure and pass parameters by reference
function addressAutoCorrect(addrLine1, addrLine2, city, state, zip) {
  pjs.define("addressLine1", { type: "char", length: 30, refParm: addrLine1 });
  pjs.define("addressLine2", { type: "char", length: 30, refParm: addrLine2 });
  pjs.define("city", { type: "char", length: 20, refParm: city });
  pjs.define("state", { type: "char", length: 2, refParm: state });
  pjs.define("zip", { type: "decimal", length: 5, decimals: 0, refParm: zip });

  pjs.callProc({
    srvpgm: "PGMLIB/ADDRESSES",
    procedure: "CORRECT",
    arguments: [
      { field: "addressLine1", byRef: true },
      { field: "addressLine2", byRef: true },
      { field: "city", byRef: true },
      { field: "state", byRef: true },
      { field: "zip", byRef: true }
    ]
  });
}
 
pjs.define("line1", { type: "char", length: 30 });
pjs.define("line2", { type: "char", length: 30 });
pjs.define("city", { type: "char", length: 20 });
pjs.define("state", { type: "char", length: 2 });
pjs.define("zip", { type: "decimal", length: 5, decimals: 0 });
 
addressLine1 = "562 CONGRESS PRK"
city = "CENTERVILLE";
state = "OH",
zip = 45458;
 
addressAutoCorrect(pjs.refParm("line1"), pjs.refParm("line2"), pjs.refParm("city"), pjs.refParm("state"), pjs.refParm("zip"));  


RPG Equivalent 

CALLP


Requirements

This API requires the Profound.js Connector module.