GeekInterview.com
  I am new, Sign me up!
 
GeekInterview.com  >  Interview Questions  >  Mainframe  >  COBOL
Go To First  |  Previous Question  |  Next Question 
 COBOL  |  Question 144 of 162    Print  
COBOL dynamic call and static call
what is difference between dynamic call and static call with examples ..?


  
Total Answers and Comments: 3 Last Update: November 05, 2008     Asked by: raju_68 
  
 Sponsored Links

 
 Best Rated Answer
Submitted by: arnab.ece
 
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)

Above answer was rated as good by the following members:
i_virus, kiranrcse
June 11, 2008 07:58:19   #1  
shaikmf Member Since: June 2008   Contribution: 2    

RE: COBOL dynamic call and static call
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.

 
Is this answer useful? Yes | NoAnswer is useful 1   Answer is not useful 0Overall Rating: +1    
July 01, 2008 07:54:01   #2  
arnab.ece Member Since: May 2008   Contribution: 1    

RE: COBOL dynamic call and static call
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)

 
Is this answer useful? Yes | NoAnswer is useful 2   Answer is not useful 0Overall Rating: +2    
November 05, 2008 02:32:56   #3  
sivachennai Member Since: November 2008   Contribution: 4    

RE: COBOL dynamic call and static call

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.



 
Is this answer useful? Yes | No


 
Go To Top


 Sponsored Links

 
About Us -  Privacy Policy -  Terms and Conditions -  Contact -  Ask Question -  Propose Category -  Site Updates 

Copyright © 2005 - 2009 GeekInterview.com. All Rights Reserved

Page copy protected against web site content infringement by Copyscape