Plex 2E

  • 1.  Parameter change in Highly used function

    Posted Feb 28, 2018 02:56 AM

    Any suggestion or idea; you have for SYNON....

    You know any method OR any way.. so that impact will be low in case we need to change the parameter of a highly used functions. Issue is that we have changed the parameter of a highly used function and it impacted all other object/function in SYNON model and appearing as "?" mark in the variable section. Any help or suggestion will be highly appreciated... I know the other way around is to use create replica and use it... but somehow we need to use the same function only...



  • 2.  Re: Parameter change in Highly used function

    Posted Feb 28, 2018 05:34 AM

    I am assuming this is for CA 2E.

     

    What type of function is it?

     

    For the existing functions that call this function you are changing is the new parameter passed with a default value or blank/zero?

     

    If the function is an EXCINTFUN or EXCEXTFUN - then it is easy to fix by adding another layer in the call path.

     

    1. Copy the existing function to a new function - if the function is an EXCEXTFUN - then change function type to EXCINTFUN.

     

    2. Change the new EXCINTFUN to have the new parameter(s).

     

    3. Edit the original function and remove all the logic (or comment it out if you want to play it safe). Then insert a call to the new EXCINTFUN function and default the new parameters as you require them.

     

    4. Change the name of the old function to indicate that it is no longer to be used and that the new EXCINTFUN function is to be used instead.

     

    For other types of functions - then I would do something similar - I would copy the function to a new function and not change the function type - add the new parameter(s) to the new function - I would then edit the internals to change the function type of the original function to an EXCINTFUN.

     

    Changing internals is not advised if you are not an expert in understanding the internal file structures - as it is not just a simple change to one field in one file - you need to make sure you do not corrupt the data model and take into consideration any change management tools you might be using. So I will not be providing any details on how to do this step here.



  • 3.  Re: Parameter change in Highly used function

    Posted Mar 01, 2018 09:41 AM

    In an RPG program, it is possible to add additional parameters without changing all the calling programs. The new parameters must be added to the end of the parameter list.

     

    By using the %parms function, you can test for the number of parameters passed into the program, and only refer to them if they have actually been passed. Typically, default values might be used if the new parameters haven't been used.

     

    I suppose you could add some user source to a 2E generated program to get the number of parameters into a variable, and only refer to the new parameters if this is an appropriate value.

     

    You don't specify whether you mean an internal or an external function. This would only work for an external function, that is an RPG program (and I haven't actually tried it myself in a 2E program).