Plex 2E

  • 1.  Converting an internal function to an external function

    Posted Jan 29, 2018 11:24 AM

    My understanding is that best practice in 2e development is to use external functions for most business logic, not internal ones.  (Smaller generated programs, less recompiles, DRY principle)

     

    We are adopting this practice, what is the best way to convert some of the existing internal functions to externals?  You can't simply change their attributes.



  • 2.  Re: Converting an internal function to an external function

    Posted Feb 02, 2018 09:47 AM

    Hi,

    Maybe there's a better way, but the way I would do it is:

    • Create a new EXCEXTFUN.
    • Set up the parameters exactly the same as the internal function.
    • In the new external function, call the internal function.
    • Add an additional line of code in the external function after the call: *EXIT PROGRAM PGM.*return code (this will ensure that the return code is returned to the calling program)
    • If the external function is likely to be called frequently, consider setting the program option: Close Down Program=N
    • Replace the Internal function with the External function in calling programs.

     

    Note that there is also an option to "Wrapper" part of an action diagram to separate the logic into an external function (from F5=User Points)

     

    It is also possible when copying certain function types to make selected changes to other function types, e.g. copying EXCINTFUN to EXCEXTFUN.

     

    - Bob



  • 3.  Re: Converting an internal function to an external function

    Posted Feb 02, 2018 01:18 PM

    Thanks Bob.   It seems like I should not have to make a copy in order to "change" it to an external function.  But I appreciate the how-to!