Versions Compared

Key

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

...

Code Block
     Fcustadrp  if   e           k disk
      *
     D custnoIn        s              4s 0
      *
     D custDataOut     ds
     D  custno                        4s 0
     D  name                         30
     D  street                       30
     D  city                         20
     D  state                         2
     D  postal                       10
      *
     C     *entry        plist
     C                   parm                    custnoIn
     C                   parm                    custDataOut
      *
     C                   clear                   custDataOut
     C     custnoIn      chain     custadrp
     C                   move      *on           *inlr
     C                   return

You can create a PAPI file, define a "get" route, with the Input Parameters and Output Parameters as shown below.

...

  • The subfield names as defined in low-code dialog "Define Data Structure Fields" do not have to match the field names as defined in the RPG program.
  • However, the attributes (data type, length, etc) must match.
  • Nested data structures are supported. You can define a subfield as data type "data structure", then right click on the subfield and take option "Add child subfield" to define the subfields for that data structure subfield. Below is an example where the subfield "addr" is a data structure made up of four child subfields.
  • If you specify the option "capture output" as "Into work variable":
    • You do not have to declare the work variable previously; it's declared for you.
    • The work variable is a JavasScript object, with one property for each subfield of the data structure, so in low-code you can refer to each "subfield" as workvar.subfield.
    • In the actual PJS code generated for the plugin, API pjs.toObject() is used to convert the data from the RPG data structure into the JavaScript object workvar. You can refer to that API for more information.
  • If you have the RPG code for the parameter interface, you do not have to manually define the parameters. You can click button "Extract parameters from RPG code snippet", paste the RPG code, and click button "Generate Parameters". The definitions for all parameters (including data structure parameters) are populated for you in the low-code plugin panel. For a data structure parameter, after it's extracted from the RPG code, you can click button "Define subfields..." to verify that the subfield definitions are correct as extracted.

...