Versions Compared

Key

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

...

You can call this low-module from another low-code module, from another "regular" (i.e. NOT low-code) PJS module, or from an RPG program. To call it from an RPG program, use the code generated in the panel "IBM i Call Interface" panel. Below is an example, there the input custno is set to 1234 to pass to the low-code module, which calls the REST service to get the customer name, which is then returned to the RPG program, which is then displayed on the screen.

Code Block
languagetext
**free

  Dcl-PR PJSCALL ExtPgm;
    ParmType        Char(30)          Const;
    ModuleID        VarUCS2(500)      Const;
    RoutineName     VarUCS2(70)       Const;
    InputParms      Char(16773104)    Const Options(*Varsize:*Omit:*NoPass);
    InputParmSize   Int(10)           Const Options(*Omit:*NoPass);
    OutputParms     Char(16773104)    Options(*Varsize:*Omit:*NoPass);
    OutputParmSize  Int(10)           Const Options(*Omit:*NoPass);
  End-PR;

  Dcl-DS InputDS Qualified Inz;
    custno  Zoned(4: 0);
  End-DS;

  Dcl-DS OutputDS Qualified Inz;
    name  VarChar(30);
  End-DS;

  InputDS.custno = 1234;			// pass input to the low-code module in "InputDS"

  Monitor;

    PJSCALL('*MODULE'
      : 'pjstips:pjstips_03_1.module.json'
      : 'routine1'
      : InputDS
      : %Size(InputDS)
      : OutputDS
      : %Size(OutputDS)
    );

  On-Error;


  EndMon;

  dsply  OutputDS.name;				// output from the low-code module in "OutputDS"		
  *inlr = *on;
  return;

...