Re: Cobol Linear search Vs Perfrom Until
From: William M. Klein (wmklein_at_nospam.netcom.com)
Date: 07/17/04
- Next message: William M. Klein: "Re: Layout Hell."
- Previous message: Glenn Someone: "Re: Cobol Linear search Vs Perfrom Until"
- In reply to: Glenn Someone: "Re: Cobol Linear search Vs Perfrom Until"
- Next in thread: LX-i: "Re: Cobol Linear search Vs Perfrom Until"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Sat, 17 Jul 2004 03:39:46 GMT
I don't know of anyone (whom I necessarily believe) who has stated in this
thread that the results are unpredictable for a table with sorted, non-duplicate
keys, in a CURRENTLY supported compiler. There may (or may not) have been some
in the past with problems. There may be people who haven't tried it recently -
because they ONCE heard there was a problem.
As far as the definition of SEARCH ALL, any implementor's definition may well
use the term "binary search" and for that implementation, it probably
(certainly?) is.
However, there have been vendors (and I think - but am not certain - that there
still are) who use "random sampling" and hashing routines for SEARCH ALL. Given
some information (that may or may not be provided by external or internal
information), such a routine might well be significantly FASTER than a binary
search - again for some tables.
As far as,
" With INSPECT I would go to reason 3) The results of the statement are not
100% predictable in any event. By this I mean if I were to produce a number of
questions listing INSPECT statements and data types, and asking for results of
the INSPECT statement, most people could not answer all of them correctly."
goes, it certainly sounds like you have worked where insufficient training was
available. If you are a contractor, this may be WHY those sites need
contractors.
I will certainly be happy to admit that when I have tried doing a VERY complex
INSPECT statement, I have (on occasion) needed to run some tests to make certain
that it was doing what I wanted it to do. However, I (personally) have never
seen an INSPECT statement that worked correctly on one currently supported
compiler NOT work correctly on another - unless one of the two had a compiler
bug - that the vendor was willing to fix.
-- Bill Klein wmklein <at> ix.netcom.com "Glenn Someone" <dontspamme@whydoyouneedmyaddressspammers.com> wrote in message news:v66hf09jf5f6c4q8u5li7hnnolfh3i05c5@4ax.com... > IF...that's the point. The rules are not set out clearly by the > standard and are inconsistent across compilers and platforms. That > much has been stated within this thread. > > And that's funny. Every book and instructor I've heard and read has > stated that SEARCH ALL = binary search. Care to enlighten us on what > the exact method is used if it is not the binary search? If it is the > binary search, then the standard is flawed because the binary search > does NOT require all table keys to be unique. > > And I'm the type of programmer to avoid as any headaches as possible. > In my experience, SEARCH and INSPECT are both pure headache generators > for two reasons: 1) They are not well defined and consistent across > platforms. and 2) They are hard-wired procedures and one must accept > and program around the actions one interprets them to perform, no > matter how cryptic they are, if one chooses to use them. > > With INSPECT I would go to reason 3) The results of the statement are > not 100% predictable in any event. By this I mean if I were to > produce a number of questions listing INSPECT statements and data > types, and asking for results of the INSPECT statement, most people > could not answer all of them correctly. In fact, I've found when I've > used rudimentary INSPECT statements, I've had to educate every person > that came in contact with that program about it. > > I think all programs should be simple, elegant, and fast. > > On Fri, 16 Jul 2004 23:14:02 GMT, "William M. Klein" > <wmklein@nospam.netcom.com> wrote: > > >SEARCH ALL is *well defined* and portable and predictable *IF* you follow the > >well documented rules. > > > >If you have a table that has "unique" key values, then using SEARCH ALL will > >*find* the expected entry and branch to AT END if there is no match. > > > >Although SEARCH ALL is definitely NOT defined as a "binary search" (and is not > >implemented as such in all current or past COBOL compilers) > > >You can avoid using SEARCH ALL (or even SEARCH) and INSPECT if you don't have > >the time to learn and understand the WELL documented rules, but I certainly > >would not recommend that to others. > > > >Learn when the Standard COBOL statements are and are not well-defined, then use > >the "best statement" for the programming task ahead of you (is my personal > >suggestion).
- Next message: William M. Klein: "Re: Layout Hell."
- Previous message: Glenn Someone: "Re: Cobol Linear search Vs Perfrom Until"
- In reply to: Glenn Someone: "Re: Cobol Linear search Vs Perfrom Until"
- Next in thread: LX-i: "Re: Cobol Linear search Vs Perfrom Until"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|
|