View previous topic :: View next topic
|
Author |
Message |
Hari Koteswararao
New User
Joined: 09 Mar 2010 Posts: 1 Location: Kolkata
|
|
|
|
After reading a very old thread, Difference between Static Call and Dynamic Call in COBOL,
I am going to explain with an example: Main program:PROGA, sub prog:PROGB.
1.In this case if you use CALL PROGB USING A,B,C; It is call static call
if you move sub prog name to some WS variable and
CALL WS-VAR USING A,B,C---It is called Dynatmic.
2. in static call if you made any changes in sub program you have to compile all the programs. but in Dynamic call need to compile only the changed programs.
3.in static call all the sub modules are link edited with main load module
where as in Dynamic call created different loadmodules. |
|
Back to top |
|
|
Karthikeyan Subbarayan
New User
Joined: 24 Feb 2008 Posts: 62 Location: Boston
|
|
|
|
I dont think calling a Sub program with some WS variable is a Dynamic call.
some additional info.
Dynamic
1) If the subprogram undergoes change. Recompile of sub program is enough
2) Sub routine picked during run time form load library
3) Program will be in the initial state every time.
4) Size of load module will be less.
Static
1) If the subprogram undergoes change. Recompile of sub program & main program is required
2) Sub module link edited with main module
3) Program won’t be in the initial state.
4) Size of the load module will be more |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Quote: |
I dont think calling a Sub program with some WS variable is a Dynamic call. |
Suggest you re-consider. . .
When a CALL is made via a WS variable it is not resolved during the linkedit and will be resolved at execution - i.e. dynamically. |
|
Back to top |
|
|
Terry Heinze
JCL Moderator
Joined: 14 Jul 2008 Posts: 1249 Location: Richfield, MN, USA
|
|
|
|
Note also that the DYNAM compiler option will cause a CALL literal to be a dynamic CALL instead of a static CALL. See Programming Guide for details. |
|
Back to top |
|
|
Ronald Burr
Active User
Joined: 22 Oct 2009 Posts: 293 Location: U.S.A.
|
|
|
|
Note, too, that in a STATIC call environment, if you change and re-compile a sub-program it is really not necessary to re-COMPILE the MAIN program, it is only necessary to re-LINK ( re-bind ) the main program - to replace the (obsolete) sub-program in the statically-linked executable.
Additionally, in a DYNAMIC call environment, a sub-program will not necessarily be in its initial state on every call unless a) a CANCEL statement has been issued prior to each CALL, or b) the sub-program has been compiled with the INITIAL attribute. In fact, there is no guarantee that the sub-program will be in its initial state even on the first call, if the sub-program was compiled with the RECURSIVE attribute, since there could be a "used" copy of the module in-core at the time of the call. |
|
Back to top |
|
|
|