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 Page History

« Previous Version 15 Next »

This method is used for passing parameters by reference either to functions or with pjs.call().

When using pjs.call(), the use of pjs.refParm() is optional. When a declared field is passed as a parameter to pjs.call(), it is automatically converted to use pjs.refParm() internally. The explicit use of pjs.refParm() may be more efficient in some cases.

Parameters

  1. Name - The name of the field to pass. The field must already be defined using pjs.define().

Return Value

An object that is used to pass the value by reference

Examples

Call an IBM i Program with By-Reference Parameter
pjs.define("myField", {type: "packed decimal", length: 7, decimals: 2});
pjs.call('mypgm', pjs.refParm("myField"));
// the statement above is equivalent to pjs.call('mypgm', myField); 
Call a function with a By-Reference Parameter
function double(number) {
  pjs.define("number", { type: 'float', length: 8, refParm: number });
  number = number * 2;
}

pjs.define("myNum", { type: 'float', length: 8, initValue: 10 });
double(pjs.refParm("myNum"));  // myNum becomes 20 after this line executes

 

RPG Equivalent

PARM

  • No labels