DavidatK
Active Member
Joined: 22 Nov 2005 Posts: 700 Location: Troy, Michigan USA
|
|
|
|
Tarunflash,
This subject has been addressed many times in the forums; if you do a search you will find much discussion on the subject.
In the most basic terms, a static call to a subroutine is when the subroutine has been included in the executable load module when you link edited it. This is done for a couple of reasons. One is efficiency; the operating system does not have to find and load the subroutine from the system libraries the first time you call it. This also makes you?re program more portable.
The downside of static calls is that if there is an updated version of the subroutine available you must re-link your program to pick it up.
Whereas, a dynamic call to a subroutine is where the subroutine is NOT included in the executable load module when you link edited it. The operating system must find and load the subroutine the first time you call it. This means that you can pick up any new versions of the subroutine without re-linking your program.
The downside of dynamic calls is that if there is an updated version of the subroutine available you will pick it up, and if there was a change in the subroutine that required you to modify your program you?re program will probably fail. And as the portability is an asset to a static call, it can be a deficit to a dynamic call because the subroutine must be in one of the system libraries and many times you are not 100% sure of the version that is being executed.
In our shop, we are making an effort to use dynamic calls, where updates and fixes to the subroutines are automatically picked up. As for not knowing the version of the subroutine running, we have incorporated a first time switch in the subroutines and display the compile date/time only the first time the subroutine is called.
When you call the subroutine it is generally considered a static call if the subroutine name is contained in quotes:
Code: |
CALL ?SUBR01? USING ....
|
And, if the subroutine name is contained in a variable it is generally considered to be dynamic.
Code: |
05 SUBROUTINE-NAME PIC X(8) VALUE ?SUBR01?.
CALL SUBROUTINE-NAME USING ....
|
However, either of these can be overridden, You can specify in the compiler that ALL subroutine calls are to be dynamic, even if contained in quotes, and/or you can specifically include the subroutines in the load module at link edit time that makes them static calls.
If this is not clear, please let me know
Dave |
|