What is the difference between static & dynamic call?

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.

Showing Answers 1 - 5 of 5 Answers

manoj

  • Oct 3rd, 2006
 

Static call takes the same memory location for actual and formal parameter. but dynamic call takes different memory locations for parameters.

thanks,

manoj

  Was this answer useful?  Yes

susi

  • Nov 27th, 2006
 

The Dynamic call also allows to enhance the programming by providing the subpgm's name at runtime.

  Was this answer useful?  Yes

Brett Phipps

  • Dec 4th, 2006
 

You are right, but you are missing the reason why this occurs.  When you are compiling this program you set the dynamic versus static call setting.  If the program is compiled statically, the subprogram becomes a part of the load.  Whereas if the program is compiled with the program dynamically, then the subprogram will not be a part of main programs load.  It only gets loaded into memory when the main program makes the call to it.

AJAY

  • Dec 19th, 2006
 

HI Buddy..... In case of STATIC CALL t load module of both t main prog and t sub prog wil b combined together.... in case of DYNAMIC CALL t load module of main and sub prog are both seperate. suppose that if u make any change in ur sub prog then in case of DYNAMIC CALL u nee not recompile your MAIN prog once again. only t sub prog needs to b recompiled...... wher as in case of STATIC CALL u need to recompile both t main and t sub prog Hope u undestood... reply back for any queries Regards AJAY

rajkumar1

  • Aug 13th, 2010
 

A statically called program is link-edited into the same load module as the calling program, a static call is faster than a dynamic call. A static call is the preferred method if your application does not require the services of the dynamic call.

Statically called programs cannot be deleted (using CANCEL), so static calls might take more main storage. If storage is a concern, think about using dynamic calls. Regardless of whether it is called, a statically called program is loaded into storage; a dynamically called program is loaded only when it is called.


Abhay

  • Aug 11th, 2011
 

Can anybody tell me the use of 'CANCEL' statement with respect to Static and Dynamic calling ?

  Was this answer useful?  Yes

anshuldas

  • Dec 19th, 2015
 

I am not sure.. But most of us use dynamic calls while working on Client requirement these days. This question to me seems an outdated one to be asked by any interviewers , But anyways really good answers.

  Was this answer useful?  Yes

Saurabh Bandyopadhyay

  • Mar 8th, 2016
 

In case of Static Call, we use the call literal.
For example, CALL PGM1.
In case of dynamic call, we define a variable and pass the sub-program name to it before calling.
Ex-
01 WS-VAR1 PIC X(08) VALUE SPACES.
.
.
In procedure div,
IF CASE-1 TRUE
THEN MOVE PGM1 TO WS-VAR1
ELSE
MOVE PGM2 TO WS-VAR2.
This is the main difference apart from complie and load separate load module creations.

Code
  1. 01 WS-VAR1       PIC X(08) VALUE SPACES.

  2. .

  3. .

  4. In procedure div,

  5.  

  6. IF CASE-1 TRUE

  7.     THEN MOVE PGM1 TO WS-VAR1

  8. ELSE

  9.             MOVE PGM2 TO WS-VAR2.

  Was this answer useful?  Yes

sadik s

  • Jun 4th, 2016
 

Static and dynamic will be decided only on compiler if NODYNAM - it is static, if DYNUM then dynamic.

  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