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

pts.
Tags:
Application development
AS/400
CLP
Development
IBM DB2
RPG
RPGLE
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?

Yorkshireman

Discuss This Question: 2  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.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • 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:
    report
  • 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:
    report

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.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

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

Following