Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

When to use Static and Dynamic Call ?

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
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    Post subject: When to use Static and Dynamic Call ?
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    Post subject: Re: When to use Static and Dynamic Call ?
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    Post subject:
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    Post subject: Re: When to use Static and Dynamic Call ?
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    Post subject:
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    Post subject:
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    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts REXX - Dynamic file Creation d_sarlie CLIST & REXX 7 Tue Jun 27, 2017 7:30 pm
No new posts Dynamic output file creation in cobol... smileheal COBOL Programming 7 Thu Jun 15, 2017 10:53 pm
No new posts Need help in REXX CALL program Raje1002 CLIST & REXX 5 Wed Apr 19, 2017 11:18 pm
No new posts Dynamic split of files under groups sril.krishy DFSORT/ICETOOL 4 Mon Apr 17, 2017 1:09 pm
No new posts Need help in triggering a PL1 module ... Varungv99 IMS DB/DC 0 Fri Apr 07, 2017 10:01 am


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us