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
 

 

Diff between SEARCH and SEARCHALL, Static & Dynamic Call

 
Post new topic   This topic is locked: you cannot edit posts or make replies.    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
karthi_ind

Active User


Joined: 24 Feb 2004
Posts: 131
Location: Chennai

PostPosted: Sat Jun 19, 2004 5:54 am    Post subject: Diff between SEARCH and SEARCHALL, Static & Dynamic Call
Reply with quote

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
View user's profile Send private message

meetsrk

New User


Joined: 13 Jun 2004
Posts: 85

PostPosted: Sat Jun 19, 2004 12:30 pm    Post subject:
Reply with quote

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
View user's profile Send private message
mcmillan

Site Admin


Joined: 18 May 2003
Posts: 1203
Location: India

PostPosted: Sun Jun 20, 2004 1:36 am    Post subject: Re
Reply with quote

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
View user's profile Send private message
vikas4u

New User


Joined: 12 Aug 2004
Posts: 14
Location: bangalore

PostPosted: Wed Sep 08, 2004 12:45 pm    Post subject: answer for 2nd question
Reply with quote

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
View user's profile Send private message
harinadh

New User


Joined: 01 Sep 2004
Posts: 18

PostPosted: Fri Sep 10, 2004 9:20 am    Post subject: regarding cobol questions
Reply with quote

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
View user's profile Send private message
khamarutheen

Active Member


Joined: 23 Aug 2005
Posts: 680
Location: NJ

PostPosted: Fri Oct 28, 2005 10:51 am    Post subject: search,search all,static dynamic
Reply with quote

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
View user's profile Send private message
guptae

Moderator


Joined: 14 Oct 2005
Posts: 1187
Location: Bangalore,India

PostPosted: Fri Oct 28, 2005 10:59 am    Post subject:
Reply with quote

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
View user's profile Send private message
khamarutheen

Active Member


Joined: 23 Aug 2005
Posts: 680
Location: NJ

PostPosted: Fri Oct 28, 2005 11:48 am    Post subject: example link for search or search all
Reply with quote

http://www.csis.ul.ie/COBOL/Exercises/Exm-CSISEmailDomain/Prg-CSISEmailDomain.htm - SEARCH
http://www.csis.ul.ie/COBOL/Exercises/Exm-DueSubsRpt/Prg-DueSubsRpt.htm - SEARCH ALL

the above links will give the complete example for the thing which you are seeking for
Back to top
View user's profile Send private message
GeethaEswaran

New User


Joined: 13 May 2006
Posts: 1

PostPosted: Fri Jul 14, 2006 11:41 am    Post subject: Re: Diff between SEARCH and SEARCHALL, Static & Dynamic
Reply with quote

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
View user's profile Send private message
sandip_mainframe
Warnings : 2

New User


Joined: 20 Sep 2006
Posts: 61
Location: pune

PostPosted: Mon Dec 18, 2006 7:10 pm    Post subject: Re: Diff between Static & Dynamic Call
Reply with quote

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
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Mon Dec 18, 2006 8:34 pm    Post subject:
Reply with quote

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
View user's profile Send private message
yaju4ever
Warnings : 1

New User


Joined: 30 Sep 2006
Posts: 19
Location: mumbai

PostPosted: Mon Dec 18, 2006 9:53 pm    Post subject: Re: Diff between SEARCH and SEARCHALL, Static & Dynamic
Reply with quote

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
View user's profile Send private message
jagdishmudiraj

New User


Joined: 25 Apr 2007
Posts: 7
Location: gurgaon

PostPosted: Wed Jun 20, 2007 6:53 pm    Post subject:
Reply with quote

Search is an linear search
where as
Searchall is a binary Search.
Back to top
View user's profile Send private message
dr_te_z

New User


Joined: 08 Jun 2007
Posts: 71
Location: Zoetermeer, the Netherlands

PostPosted: Wed Jun 20, 2007 7:03 pm    Post subject:
Reply with quote

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
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Wed Jun 20, 2007 7:37 pm    Post subject:
Reply with quote

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   This topic is locked: you cannot edit posts or make replies.    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 Dynamic array request/response contai... Suja.Sai CICS 2 Tue Jan 24, 2017 11:37 am
No new posts REXX DB2: Dynamic allocation of DB2.D... BHAS CLIST & REXX 3 Mon Dec 19, 2016 8:26 pm
No new posts Cobol EZASOKET call to SETSOCKOPT fails Andi1982 COBOL Programming 6 Thu Oct 06, 2016 7:12 pm
No new posts Strange EXEC function call in z/VM Willy Jensen CLIST & REXX 3 Wed Oct 05, 2016 2:07 pm
No new posts COBOL DB2 - CALL statement - high CPU... TS70363 DB2 15 Sun Sep 11, 2016 6:07 am


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