View previous topic :: View next topic |
Author |
Message |
abracadabra Beginner
Joined: 02 Sep 2003 Posts: 101 Topics: 55 Location: India
|
Posted: Sat Jan 03, 2004 12:29 am Post subject: Static and Dynamic Call difference |
|
|
Hi,
In static call, the program name is hard coded and while compiling the main program , the sub program load module should be specified whereas in dynamic call, the program is not hard coded but made up in the program. Moreover, the load module of the sub program is picked up at run time. The compilation parameter by default i believe is nodynam.
Moreover, if i make a change in the sub program, for static call the main program has to be compiled again while it is not the case for dynamic call.
Is there any other difference between the two? Also how is the sub program picked at run time during dynamic call?
Thanks _________________ Cheers! |
|
Back to top |
|
|
slade Intermediate
Joined: 07 Feb 2003 Posts: 266 Topics: 1 Location: Edison, NJ USA
|
Posted: Sat Jan 03, 2004 11:17 pm Post subject: |
|
|
Hi abcd,
Here's the skinny on how a static/dynam call is determined:
If compiled as NODYNAM:
CALL 'literal' is a static call
CALL WS-label is a dynamic call
If compiled as DYNAM:
CALL 'literal' is a dynamic call
CALL WS-label is a dynamic call
You're right about subpgm updates.
One advantage of a static CALL is that it only sets the param list and the return address, loads register 15 and branches to the address in reg15 (the EP of the subpgm). A dynam CALL requires the assistance of a system module to select and search the JOB/STEP libs and load/exec the subpgm.
There are other differences about how data in WS is retained (or not) depending on your choices and the options available. I'll leave that research up to you.
To find a dynamically called pgm the system (don't know the module name) searches the directories of any JOB/STEP libs (implicit or explicit) for the module used in the CALL stmt and loads/executes the subpgm.
Regards, Jack. |
|
Back to top |
|
|
kolusu Site Admin
Joined: 26 Nov 2002 Posts: 12376 Topics: 75 Location: San Jose
|
|
Back to top |
|
|
|
|