What is the difference between static call and dynamic call?

Showing Answers 1 - 24 of 24 Answers

techie

  • Sep 11th, 2006
 

Static calls refer to calls made to subprograms that was link-edited to the main program at compile time. That is , the subprogram's object code is part of the main programs object code. This is established on compile time with the NODYNAM compiler option.Dynamic calls refer to calls made to programs with separate object code from the main program. This is established on compile time with the DYNAM compiler option.Subprogram called in STATIC mode will always contain values from previous calls if the "INITIAL" keyword was not coded in the Program-ID declaration in the subprogram's IDENTIFICATION DIVISION. But you can reset the values by coding CANCEL from the main program.Subprogram called in DYNAMIC mode will always be in initial state.Hope this helps.

  Was this answer useful?  Yes

Rajesh kumar Singh

  • Sep 12th, 2006
 

In static call actual and formal parameters share same memory location but in dynamic call they uses different memory locations.

  Was this answer useful?  Yes

manasa

  • Oct 2nd, 2006
 

in the case of static call the mainprogram and subpgms r loaded into the mainmemory initially.in the case of dynamic call only the mainpgm is loaded first and the subpgm is loaded only when a call to it is made.so the memory utilization is good in dynamic call.

  Was this answer useful?  Yes

hemamlec

  • Mar 5th, 2008
 

If we do any chnages to sub-pgm need to compile both main and sub pgms in STATIC call where as in DYNAMIC call need to compile sub-pgm ALONE
Cheers
Hema

  Was this answer useful?  Yes

haiardhan

  • Nov 11th, 2008
 

static call :the subprogram will call like 'subpgmname'
dynamic call : the sub program will be calling with variable.
ex :01 spgm pic x(5).  
move subpgm to wspgm
call spgm
static :call a single program
dynamic : we can call many programs,
                here we will maintain seperate load module,
                if there were any changes are in sub program need not to recompile      mainpgm and subpgm ,subpgm compilation is enough,
static: if there were any changes in sub pgm.( compile) both subpgm&main program need to be re recompile because both load modules will be in single load library ,so subpgm load module should be linkedited with mainpgm-load module.
dynamic loadmodule will pick up at runtime only
static------>compile......ubload+linkload....run
dynamic--->compile...................................run

  Was this answer useful?  Yes

toton_tcs

  • Mar 2nd, 2010
 

In static call calling program and calling and called program must be linkedited in a single load module wheras in dynamic call they are stored in different load modules.

  Was this answer useful?  Yes

Static Call: All sub programs followed the Main program. Here we can use Global variable, Call by value and Call by reference method.

At the compilation no need to give diff load modules.

Dynamic Call : All sub progs are located in different members. Main also loaded in one different member.

At the compilation time first we have to compile sub progs, by using those sub progs load modules, you can run the Main prog. Then we get one Load module. That load module will be used to run the prog as COBOL prog compilation.

  Was this answer useful?  Yes

sobhan

  • Dec 10th, 2014
 

Evaluation binding in COBOL

  Was this answer useful?  Yes

Maria

  • Jun 16th, 2015
 

We can identify whether the call is static or dynamic by seeing the CALL structure.
Static Call: we refer the program name in the CALL statement. e.g. CALL PGM1
Dynamic call : we use one WS variable which is populated with the called program name at run time.
e.g. 01 WS-PGM pic X(08).
in the code, MOVE PGM1 to WS-PGM
CALL WS-PGM
When to go for static or dynamic call ?
In case of static call, if we have a main program MAIN-A and it calls two sub programs SUB-A and SUB-B, we will have only ONE load module for these three modules. load modules of sub programs will be linked edited to the main program load module. Negative point : since the load modules exist together, it will take up more virtual space. if any changes made to called pgm, then all the pgms must be complied and linked. Positive point: Execution is fast.
In case of dynamic call: the load modules of called and calling pgms exist separately. Positive point: doesnt not take unnecessary space. Since these are stand alone load modules, we can compile and link respective modules without touching other. Negative point: Execution will be bit slow[pgm call resolution]
we use the compiler options, we can override these calls .
If compiled with NODYNAM compiler option
CALL PGM-1 will be handled as a static call
CALL WS-PGM will be treated as dynamic call
If compiled with DYNAM compiler option:
CALL PGM-1 will be also treated as a dynamic call
CALL WS-PGM will be treated as a dynamic call

  Was this answer useful?  Yes

Kathir

  • Jul 1st, 2017
 

Static Call: Sub programs compiled version of code is embedded with main program so if compile sub program with modified changes then main program is also being compiled.

Dynamic Call:Sub programs version of code is not embedded with main program and it is executable separately..so if compile the subprogram with modified changes then need to compile the main program as well

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions