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

When to use Static and Dynamic Call ?


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

New User


Joined: 05 May 2006
Posts: 2

PostPosted: Tue May 09, 2006 3:26 pm
Reply with quote

When to use Static Calls and when to use Dynamic Calls ?
Back to top
View user's profile Send private message
DavidatK

Active Member


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

PostPosted: Tue May 09, 2006 10:04 pm
Reply with quote

Dhrubamaiti,

You would use Static Subroutine calls when you want the subroutine object module to be included with your program executable load module.
This will:
1 ? Create a load module that is more transportable.
2 ? Will not require access to the load library where the subroutine load module is stored at execution time.
3 ? Create a load module that is larger.
4 ? Will require a re-link of your program object module to pick up any upgrades, enhancements to the subroutine
5 ? Be marginally faster because the operating system does not have to search for and load the subroutine into storage when called.

You would use Dynamic Subroutine calls when you do not want the subroutine object module to be included with your program executable load module.
This will:
1 ? Require access to the load library where the subroutine load module is stored at execution time.
2 ? Create the smallest program load module. (This could be desirable if you have a large number of subroutine that could be called, but normally are not)
3 ? Require the operating system to search for and load the subroutine into storage on the first call to the subroutine. (The subroutine will stay resident until your program ends or you specifically release it. For all practical purposes the subroutine becomes static after the first call)
4 ? Allow updates, enhancements to the subroutine to be automatically picked up without having to re-link your program.

Dave
Back to top
View user's profile Send private message
jz1b0c

Active User


Joined: 25 Jan 2004
Posts: 160
Location: Toronto, Canada

PostPosted: Wed May 10, 2006 12:28 am
Reply with quote

Here is a practical scenario,

PGMB is your subprogram which is called by PGMMAIN

now if PGMB is called for 10 times, in such case every time loading the program PGMB would not be a good idea, so in such scenario's you can use statis calls.

However it depends if the mail program size is already large enough they you may want to make 10 dynamic calls
Back to top
View user's profile Send private message
DavidatK

Active Member


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

PostPosted: Wed May 10, 2006 1:18 am
Reply with quote

Masade,

This is not the way dynamic calls work. The first time a call is made to a dynamic subroutine it is loaded into storage by the operating system, and stays there. All subsequent calls to the subroutine DO NOT require a load by the operating system and are no more overhead than a static subroutine.

Dave
Back to top
View user's profile Send private message
jz1b0c

Active User


Joined: 25 Jan 2004
Posts: 160
Location: Toronto, Canada

PostPosted: Wed May 10, 2006 1:57 am
Reply with quote

Well I want to make a correction,

Here is some help on Static Vs Dynamic from Faq's I had




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. Storage usage of calls depends on whether:
The subprogram is called only a few times. 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.
You subsequently delete the dynamically called subprogram with a CANCEL statement.
You cannot delete a statically called program, but you can delete a dynamically called program. Using a dynamic call and then a CANCEL statement to delete the dynamically called program after it is no longer needed in the application (and not after each call to it) might require less storage than using a static call.
Back to top
View user's profile Send private message
parikshit123

Active User


Joined: 01 Jul 2005
Posts: 269
Location: India

PostPosted: Wed May 10, 2006 5:15 pm
Reply with quote

Hi,

I can think of another factor that depends on your choice of static/dynamic call.

If call to a subprogram depends on some conditions being fulfilled, you would like to go for dynamic call if other factors are in favour of dynamic call.

So, if a subprogram is not always going to be called, you should think of having dynamic call.
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 Using Dynamic file handler in the Fil... COBOL Programming 2
No new posts Error while running web tool kit REXX... CLIST & REXX 5
No new posts JCL Dynamic System Symbols JCL & VSAM 3
No new posts Call program, directly from panel CLIST & REXX 9
No new posts Synctool-dynamic split job for varyin... JCL & VSAM 7
Search our Forums:

Back to Top