COBOL dynamic call and static call

What is difference between dynamic call and static call with examples ..?

Questions by raju_68

Showing Answers 1 - 3 of 3 Answers

shaikmf

  • Jun 11th, 2008
 

Static Call:
1. in COBOL if you Code a call statement as fooliows is a static call.
CALL 'Pgm1' Using Var1, Var2, ...
2. Compiler option for Static call is NODYNAM
3. Calling Program and Called program loads are available in same loadmoduale.
4. It occupies more Real memory due to all loadmodules are available in real memory.
5. Processing will be Fast due to all programs loads are available in memory.

Dynamic Call:
2. If you write a Call statement by using Call leterals this type of call is called as Dynamic call as follows.
CALL WS-PGM1 Using Var1, Var2,...
2. Compiler Option for Dynamic call is DYNAM.
3. Called program and calling program will be available in separate loads.
4. On Execution Program will occupy less memory due to only active program load will be loaded in the real memory.
5. Processing speed will be slow compare with Static call. because main program calling Subprogram then main program will be replaced with subprogram in the memory and once sub program finishes execution again main program will be loaded so loading and unloading will decrease speed of execution.

arnab.ece

  • Jul 1st, 2008
 

here is some information about static and dynamic calls which may help you.

Static CALLs
In COBOL, you normally call a subroutine like this:

CALL 'A' USING arguments

The static form of the CALL statement specifies the name of the subroutine as a literal; e.g., it is in quotes.

This is the static form of a subroutine call. The compiler generates object code for this which will cause the linker to copy the object module a.obj into your executable when it is linked.

So, if you modify "A" and recompile it, you must also relink all of the executables that call "A", because the each of the executables contains its own copy of "A".

Dynamic CALLs
In COBOL, the dynamic form of a subroutine call is coded like this:

01 SUBROUTINE-A PIC X(8) VALUE 'A'.
CALL SUBROUTINE-A USING arguments


The dynamic form of the CALL statement specifies the name of the subroutine using a variable; the variable contains the name of the subroutine to be invoked.

The difference is that the name of the subroutine is found in the variable SUBROUTINE-A. The compiled code will cause the operating system to load the subroutine when it is required instead of incorporating it into the executable..

some compilers let you set options that will override the calling mechanisms shown above. Therefore, even if your program is coded to call a program statically, the compiler can convert it to the dynamic form of CALL if you set (or don't set) the correct compiler options(i.e thru DYNAM option in jcl)

Calling With in the program is called static call.
Calling out side the program (other program) is called Dynamic call.
Main and sub-programs are stored in single load module in static call.
Main and sub-programs are stored in different load module in dynamic call.
If you are made any change in static call using program you need to re run all
the programes or load module.
In dynamic call Just you can run in which program you made changes or in which
load module.


  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