IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

static and dynamic call in cobol


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
tarunflash

New User


Joined: 15 Oct 2005
Posts: 25

PostPosted: Fri Jan 27, 2006 6:42 pm
Reply with quote

can anybody explain me about static n dynamic call with example
Back to top
View user's profile Send private message
DavidatK

Active Member


Joined: 22 Nov 2005
Posts: 700
Location: Troy, Michigan USA

PostPosted: Sat Jan 28, 2006 1:12 am
Reply with quote

Tarunflash,

This subject has been addressed many times in the forums; if you do a search you will find much discussion on the subject.

In the most basic terms, a static call to a subroutine is when the subroutine has been included in the executable load module when you link edited it. This is done for a couple of reasons. One is efficiency; the operating system does not have to find and load the subroutine from the system libraries the first time you call it. This also makes you?re program more portable.

The downside of static calls is that if there is an updated version of the subroutine available you must re-link your program to pick it up.

Whereas, a dynamic call to a subroutine is where the subroutine is NOT included in the executable load module when you link edited it. The operating system must find and load the subroutine the first time you call it. This means that you can pick up any new versions of the subroutine without re-linking your program.

The downside of dynamic calls is that if there is an updated version of the subroutine available you will pick it up, and if there was a change in the subroutine that required you to modify your program you?re program will probably fail. And as the portability is an asset to a static call, it can be a deficit to a dynamic call because the subroutine must be in one of the system libraries and many times you are not 100% sure of the version that is being executed.

In our shop, we are making an effort to use dynamic calls, where updates and fixes to the subroutines are automatically picked up. As for not knowing the version of the subroutine running, we have incorporated a first time switch in the subroutines and display the compile date/time only the first time the subroutine is called.

When you call the subroutine it is generally considered a static call if the subroutine name is contained in quotes:

Code:


   CALL ?SUBR01? USING ....



And, if the subroutine name is contained in a variable it is generally considered to be dynamic.

Code:

   05 SUBROUTINE-NAME    PIC X(8)   VALUE ?SUBR01?.

   CALL SUBROUTINE-NAME USING ....



However, either of these can be overridden, You can specify in the compiler that ALL subroutine calls are to be dynamic, even if contained in quotes, and/or you can specifically include the subroutines in the load module at link edit time that makes them static calls.

If this is not clear, please let me know

Dave
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts Replace each space in cobol string wi... COBOL Programming 3
No new posts COBOL -Linkage Section-Case Sensitive COBOL Programming 1
No new posts COBOL ZOS Web Enablement Toolkit HTTP... COBOL Programming 0
No new posts Calling DFSORT from Cobol, using OUTF... DFSORT/ICETOOL 5
No new posts Generate random number from range of ... COBOL Programming 3
Search our Forums:

Back to Top