Re: Cobol Linear search Vs Perfrom Until
docdwarf_at_panix.com
Date: 07/16/04
- Next message: Chuck Stevens: "Re: Cobol Linear search Vs Perfrom Until"
- Previous message: William M. Klein: "z/OS - COBOL with Language Environment Education"
- In reply to: Frederico Fonseca: "Re: Cobol Linear search Vs Perfrom Until"
- Next in thread: Chuck Stevens: "Re: Cobol Linear search Vs Perfrom Until"
- Reply: Chuck Stevens: "Re: Cobol Linear search Vs Perfrom Until"
- Reply: Frederico Fonseca: "Re: Cobol Linear search Vs Perfrom Until"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 16 Jul 2004 14:06:54 -0400
In article <3e1gf0pop10e6hn7tikg90ocvd9jopvd7h@4ax.com>,
Frederico Fonseca <real-email-in-msg-spam@email.com> wrote:
[snip]
>search all
>when blabla
> set found to true.
>end search
>
>if found
> perform varying index from index by -1
> until index < 1
> or var(index) not = search-key
> continue
> end-perform
> index now contains the first occurrence of search-key
>end-if
>
>In some cases I would also do a perform varying +1 to get the last
>occurrence.
Hmmmmm... Mr Fonesca, this approach makes me... uncomfortable. As I
recall it - and my memory is, admittedly, porous - a SEARCH ALL against a
table with duplicate entries will return a result for a duplicate key
whose position is unpredictable; if you have five duplicate entries the
position returned could be for any of them. If your search returned the
first occurrence of the key then -1 would bring you into another key's
data and if the search returned the last a +1 would do the same; it seems
to me that you'd have to do both -1 and +1 to get the full range... and
all this peeking and poking about, above and below, makes me...
uncomfortable.
But hey... what's a programmer's comfort when compared to the simplicity
of an 'all ya gotta do is' solution?
DD
- Next message: Chuck Stevens: "Re: Cobol Linear search Vs Perfrom Until"
- Previous message: William M. Klein: "z/OS - COBOL with Language Environment Education"
- In reply to: Frederico Fonseca: "Re: Cobol Linear search Vs Perfrom Until"
- Next in thread: Chuck Stevens: "Re: Cobol Linear search Vs Perfrom Until"
- Reply: Chuck Stevens: "Re: Cobol Linear search Vs Perfrom Until"
- Reply: Frederico Fonseca: "Re: Cobol Linear search Vs Perfrom Until"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]