Synon/Cool:2E – internal/external func performance question

Application development
I have a situation where I have to call a synon function multiple times (for each record in a file one after another) from another synon function. The called function does some calculatons. Will there be any performance improvement if I make the called func an internal function and have an external function call it, instead of making the called func external?

Answer Wiki

Thanks. We'll let you know when a new response is added.

When you use an internal function you keep the code in line in the main program. When you use an external function the program has to make a call the new program, open files, close files, etc. (with some dependcies on how you write the external function). You are always better off using an internal function over an external one.

– – — – – – – – – – – – – – – – – –

An internal function is best regarded as a subroutine, so when generated, your external function will have a (subroutine) which is used for each record. there will then be no question of additional overhead.

Unless the functionality is required for other programs, then you could choose not to embed it within an internal function, just code it, presumably within the RTVOBJ which is reading the file.

You description sounds like a conventional RTVOBJ – why is it different?


Discuss This Question: 3  Replies

There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.
  • JohanBraam
    If you generate RPG and leave the files open, then there is almost no difference. We are using COBOL and so far I know, all the files are closed when the function ends. When there are no files in the external function and you can use this function in more programs, then you have an advantage in maintenance. Pay attention to the parm fields. Pass them as RCD instead of FLD. If you are using ILE, it's always better to separate functions.
    0 pointsBadges:
  • Reenasudarshan
    Rituraj, Instead of creating an internal function, share the access path of the function which you are calling multiple times. This creates a single routine in the source code and is performed each time you call the function with the corresponding parameter.
    65 pointsBadges:
  • SaurabhChakraborty
    If *ARRAYS are used for this kind if scenario then there will be a huge impact on the system performance. But if direct reads and with keys are done then there will not be any impact on the system, it will be working as it works exactly in AS/400.
    355 pointsBadges:

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

Thanks! We'll email you when relevant content is added and updated.


Share this item with your network: