View previous topic :: View next topic
|
Author |
Message |
karthi_ind
Active User
Joined: 24 Feb 2004 Posts: 131 Location: Chennai
|
|
|
|
hi to all
my questions are
1) diff. between static and dynamic linking or static and dynamic call
(with examples)
2) diff. between search and search all (with examples)
anbudan
karthi G. |
|
Back to top |
|
|
meetsrk
New User
Joined: 13 Jun 2004 Posts: 85
|
|
|
|
hi karthik_ind,
i dunno the answer for the first question.
but for the second one the aswer is,
search is used when the data is in ascending or descending or not in order
whereas,
searchall is used when the data is in ascending or descending order.
eg. will be given later |
|
Back to top |
|
|
mcmillan
Site Admin
Joined: 18 May 2003 Posts: 1210 Location: India
|
|
|
|
Dear friend,
Quote: |
diff. between static and dynamic linking or static and dynamic call |
If you know the sub program name at compile time, it's called as static call.
Dynamically called programs are identified at run time and linkedited interactively. For that, it must be in copy library and you should specify DYNAM compiler option. |
|
Back to top |
|
|
vikas4u
New User
Joined: 12 Aug 2004 Posts: 14 Location: bangalore
|
|
|
|
hi,
search is a linear search.
searchall is a binary search.
when we have to search from the large data set then we go for searchall.
in searchall the data should be in ascending order.
in search the data may be in any order or even without an order. |
|
Back to top |
|
|
harinadh
New User
Joined: 01 Sep 2004 Posts: 18
|
|
|
|
Hi,
Search is sequential search. We can use any relation operator in that search condition.
Search ALL is binary search . We can give only = operator for that search condition.
But, Search ALL is very efficient. The records in that file should be in order. |
|
Back to top |
|
|
khamarutheen
Active Member
Joined: 23 Aug 2005 Posts: 677 Location: NJ
|
|
|
|
hi friend,
you can get the example in MK ROY book titled 'cobol programming'.
SEARCH is sequential search where the i/p should be in an ordered manner
SEARCH ALL is binary search, its the efficient method and time consuming method of searching. it takes the center value and serches reg that value lies b/w it. but SEARCH starts from begining till the end.
STATIC call is if you know the prog or the value that you are going to pass in advance is the static call.
DYNAMIC call is if you are going to pass the value or the procedure name during the bind or the run time is the dynamic call. |
|
Back to top |
|
|
guptae
Moderator
Joined: 14 Oct 2005 Posts: 1208 Location: Bangalore,India
|
|
|
|
Difference betwwen static & dynamic call
1) In static Call, the called subroutine is link-edited into the calling program , while in dynamic linking, the subroutine & the main program will exist as separate load modules.
2) A statically called subroutine will not be in its initial state the next time it is called unless you explicitly use INITIAL or you do a CANCEL. A dynamically called routine will always be in its initial state. |
|
Back to top |
|
|
khamarutheen
Active Member
Joined: 23 Aug 2005 Posts: 677 Location: NJ
|
|
Back to top |
|
|
GeethaEswaran
New User
Joined: 13 May 2006 Posts: 1
|
|
|
|
Hi Karthik,
I have shared my knowledge about the difference between static and dynamic calls. Hope you can get a clear picture.
Difference between Static Call and Dynamic Call:
The main difference between static and dynamic call is the time at which the load module of a subroutine gets invoked or gets attached to the load module of its main program. To get a better picture, let us take an example.
Let A be the Main Program, and this main program invokes the subroutines X, Y and Z. We would have coded the modules X, Y, Z and would have compiled it before executing A.
Static Call:
Now, a static call to the modules X, Y and Z means attaching the load modules of X, Y, Z to the load module of A. It?s like creating a single pack which contains all the load modules needed to execute a higher level program which calls many other programs. This can be done by specifying the compiler option "NODYAM" while compiling the program.
All the load modules of sub routines are embedded within the load module of the main progam.
Dynamic Call:
A dynamic call to the modules X,Y and Z means that you will not attach the load modules of X,Y, Z to the load module of A. The load modules of X,Y and Z will lie in a separate library and the load module of A will lie in a separate library. You will just refer to the library in which the load modules of X,Y and Z lie, while executing the program A. So when ever the subroutines X or Y or Z are invoked in the program A, the library which is specified will be searched for the load modules. By mistake, if the library of the subroutine does not contain the referred program, the system standard library will be searched. If the program is not found in standard library too, the programs will abend. This can be done by specifying the compiler option "DYNAM" while compiling the program.
Performance Comparison of Static Call and Dynamic Call:
Both Static call and Dynamic Call are advantageous depending on various parameters.
1) If your subroutines involve frequent changes, then static call will be a burden. Since the load module of the subroutine is embedded inside the load module of the main program, when ever you recompile the subroutine, you should relink(Process of replacing the old load module with new one) the main program. This surely will be a burden. In dynamic call, it?s enough if you recompile the sub-routine and put it in the specified library. The new load module will be invoked automatically from the library specified.
2) On the other hand, statically called programs take less time to execute. The overload of searching the library and then invoking the required load is not present in case of static calls.
So, depending on our application need both static calls and dynamic calls are advantageous. |
|
Back to top |
|
|
sandip_mainframe Warnings : 2 New User
Joined: 20 Sep 2006 Posts: 63 Location: pune
|
|
|
|
hi,
diff between static and dynamic call is:-
1. in static call both calling and called programs have one load module
they share only one load module.
while in dynamic calling both calling and called program have their
seaperate load modules.
sandip. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
An important concept to remember is that if you use a static call and the "called" code changes, EVERYTHING that calles the module (referenced in the static call) must be re-linked for the change to work.
If you use a dynamic call, the current copy will be used at run-time with no additional work on the calling programs.
Of course, if anything in the parameters that are used between the calling and called modules are changed, everything (the called code and all of the callers) will usually have to be changed to accomodate the parameter change. |
|
Back to top |
|
|
yaju4ever Warnings : 1 New User
Joined: 30 Sep 2006 Posts: 19 Location: mumbai
|
|
|
|
i wanna add some more differnces .....
these are.
--as we know tht index is need to be defined for both the searching so in
"search all " there is no need to initialize index for traversing a table unlike "search" verb.
--there is a "varying - identifier or index" option in search but not in "search all"
--through "varying" option we can use another index instead of default index...and travers a table through tht index but such a provision is not available with "search all".
--complexty of execution will be less in the search all as compared to search in case of large amount of data.
i welcome the suggesions on this answer.... |
|
Back to top |
|
|
jagdishmudiraj
New User
Joined: 25 Apr 2007 Posts: 7 Location: gurgaon
|
|
|
|
Search is an linear search
where as
Searchall is a binary Search. |
|
Back to top |
|
|
dr_te_z
New User
Joined: 08 Jun 2007 Posts: 71 Location: Zoetermeer, the Netherlands
|
|
|
|
I've been told once that the break-even-point lies around 30 entries in your array.
So when you have less than 30 a SEARCH is faster because you loose too much on overhead.
When you have more than 30 occurences then the SEARCH ALL algorithm begins to pay off. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Something else that pays off nicely (and costs little) is to check if the value currently being searched for is the same as the value as the previous value searched for - if it is there is no need to search, just use the array entry already "found". |
|
Back to top |
|
|
|