Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Query on Static V/S Dynamic Calls

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
sats456

New User


Joined: 29 May 2005
Posts: 12

PostPosted: Sun May 29, 2005 11:27 pm    Post subject: Query on Static V/S Dynamic Calls
Reply with quote

HI All,
Could anyone of you clear my confusion on the difference between Static V/S Dynamic Calls in COBOL.
Which one is better under what circumstances ?
1) Suppose I have a main program which calls 100 other programs (each one only once) which one would be better i.e Static or Dynamic Call ?

2) Similarly if I have a main program which calls a single program 100 times then in that case which one would be better i.e Static or Dynamic Call ?


Appreciate your quick feedback..

Regards,
Sats
Back to top
View user's profile Send private message

kanak

Moderator


Joined: 12 Mar 2005
Posts: 252
Location: India

PostPosted: Mon May 30, 2005 11:21 am    Post subject:
Reply with quote

While making decesion wheather to make satatic call or dynamic cal i think we can check if the size of the called program.If the called program is very small then we can go for static call, otherwise dynamic call will be better. As in static call, called program is embeded into calling programs load module.

In your first case since the number of called program is too high so it will be better to go for dynamic call, as if you go for static call and if any one of the 100 programs get changed then u need to compile all the 100 programs in correct sequence.

In second case what you have mentioned it is better to go for static call, as main rpogram is calling 100 times the subroutine program. As in dynamic call, control need to passed to different object module, so it will take more time, where as in static call there will be only one load module, so time consumption will be less in that case.
hope this will give a clear idea.Let us know if you have any concerns
Back to top
View user's profile Send private message
sats456

New User


Joined: 29 May 2005
Posts: 12

PostPosted: Mon May 30, 2005 7:51 pm    Post subject: Re: Query on Static V/S Dynamic Calls
Reply with quote

Kanak,
I really appreciate your quick & detailed response.Thanks for your Efforts.
I still had some doubts on first part of my Query.

Do you mean to say in case of Static Calls,The load module of all the called Programs will be embedded in the Load Module of the Main program.
Where as in case of Dynamic Calls,load Module of called program will be loaded into Main Memory as when the Program requires it and then later released.

Appreciate if you (or anybody ) could answer this..

Regards,
Sats
Back to top
View user's profile Send private message
kanak

Moderator


Joined: 12 Mar 2005
Posts: 252
Location: India

PostPosted: Mon May 30, 2005 8:00 pm    Post subject:
Reply with quote

hi sats,
in static call, the object module is created seperately but while performing the link edit stpe only one laod module is generated.

where as in dynamic call, object module as well as load module both are different, that is why if you are calling program as dynamicaly you dopn't need to recompile the called program, if any modification is done in the called or mainline as it is decided in run time.

where as in static call, if called program is changed then you need to rebuild the load module again as static call embed the called program and calling program load module in a single load module.
Correct me if i am wrong.
Hope this clarify ur doubts. Let us know if you have any other query.
Back to top
View user's profile Send private message
mmwife

Super Moderator


Joined: 30 May 2003
Posts: 1592

PostPosted: Mon May 30, 2005 11:13 pm    Post subject:
Reply with quote

Hi Sats,

As is the case in most pgming choices one must evaluate the "tradeoffs" involved.

Statically linked modules:
accumulate virtual space on disk - bad. See Note 1 below
execute with a branch to the entry point - good (fast).
if 1 changes all must be relinked - bad.

Dynamically linked modules:
don't accumulate virtual space on disk - good.
execute with system assist & ohead - bad (slow). See Note 2 below.
if 1 changes only it must be relinked - good.


Note 1 - If main mod is 10K and each of the 100 subs is 5k the combined static load mod is 510K. The dynamic is 10K, but will use only 15K. As I recall you issue a CANCEL after each use of a submod to get a fresh copy of the code; if you need totals already accumulated, you'd want to avoid the CANCEL.
Note 2 - When each dynamic mod is CALLed memory is 1st searched for a useable copy. If none is found loadlib is searched and the mod is loaded (that means reads are done against the load PDS) and control is then passed to the called mod.


So it boils down to a process of evaluating the "tradeoffs" (good vs bad) and making a decision. Now you know why the ques was posed as it was.

BTW, you said:
Quote:
Appreciate your quick feedback.

I assume this was an interview ques and the interview is over. Why the rush? No problem, Just curious.
Back to top
View user's profile Send private message
sats456

New User


Joined: 29 May 2005
Posts: 12

PostPosted: Tue May 31, 2005 7:52 pm    Post subject: Re: Query on Static V/S Dynamic Calls
Reply with quote

Thanks to you all..
All my Queries have been resolved now.
I really appreciate the efforts of everyone.

Regards,
Sats
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 Create procedure issues -628 when add... chandraBE DB2 1 Mon Sep 18, 2017 12:16 pm
No new posts Can we limit length in concatenation ... balaji81_k DB2 7 Tue Aug 22, 2017 2:50 am
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 DB2 query to fetch previous row ! Chandan1993 DB2 10 Sat Jun 03, 2017 10:43 am

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us