• If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Announcement

Collapse
No announcement yet.

How can I obtain parameters within called RPG program?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • How can I obtain parameters within called RPG program?

    Hello,

    I created a NITRO app. In the app behaviors under the main section I added a button. When a user clicks the button I intend for the user to enter parameters to be passed to a rpg program and be used in a SQL select statements there. On click of the button the app calls a SQLRPGLE program.

    In the App within the called RPG program details I specified parameters within the "prompt user for more information" dialogue. The following parameters are defined: CloseYear, CloseMonth, Company, PlantArea, PrintSequence and CostType. The first four have type = dropdown. The last two have type = text. The last wo are defined as variables in the app. All are required except PlantArea.

    I created a SQLRPG program using the EXNABBTN example provided by CNX as the base template. I need to pass the parameters specified in the app to the RPG program.

    After compiling the RPG program I find that the EXNABBTN /include qcpylesrc,vvNabBtn includes an *entry plist with one parm Gsid having a length of 64. Where and how in the RPG program do I need to define of the program variables to receive the parameters from the app.I have defined them as stand alone fields and as subfields in a Dcl-Pr, but with no success obtaining the parm values.

    In the RPG program I have unsuccessfully tried to use GetFilterValue, GetAppVar, Get FormNum and GetFormChar to try and retrieve the parameter values. When I check a program dump the associated program variables are all empty.

    When I run the Nitro app and click the button that I defined in the App behaviors a popup panel appears with 4 drop down fields for the first 4 parameters. Recall that the last two are defined elsewhere in the app as variables. After selecting values from the drop down fields I click the OK button. I get "No Results" back in the App. The App has one grid widget. The drop down fields are defined with other datasets and grids.

    I'm not sure if I need to use GetFilterValue, GetAppVar, Get FormNum or GetFormChar to retrieve the input parameter values. Please clarify on that point. Which do I need to use for the drop down field parms and which one for the app variables?

    I have also executed calls to the RPG program using the Valence Test RPG call feature with the 6 parms defined and populated with values. I have specified the following in the RPG.

    SetResponse('success':'true');
    SetResponse('info':'Processing completed');
    SetResponse('refresh':'true');
    SetResponse('info':'My Message ' + %char(CloseYr));

    The following is returned in the JSON when I call the RPG with the test RPG feature. Note that the CloseYr variable = 0 in the last SetResponse. It should equal 2021 the year entered in the test RPG dialogue. I also see the "My Message 0" in the snackbar when I run the app.

    { "success": true, "info": "My Message 0", "refresh": true }

    I have tried to be thorough in my description of the issue. I would appreciate your assistance.

    Thank you for reading the lengthy post.

    Larry

  • #2
    Hi Larry -

    Any parameters that you specify in the Call RPG Program > Prompt User For More Info can be pulled in using the appropriate vvIn procedure.

    If CloseYear is defined as a numeric, you would use vvIn_num. For any text/character values, you would use vvIn_char

    Code:
    lCloseYear = vvIn_num('CloseYear');
    lCostType  = vvIn_char('CostType');

    Comment


    • #3
      Hi Sean,

      Thank you for the quick response. I will give that a try and share the outcome here.

      Kind regards,

      Larry

      Comment


      • #4
        I'm happy to report that the vvIn functions solved the issue.

        Thank you.

        Comment

        Working...
        X