Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Search on double values

Status
Not open for further replies.

foehni

Programmer
Aug 16, 2002
3
DE
Hi,

I have a problem. I have the following table
01 table.
05 element pic 9(006) occurs 50 times indexed by ind.

After filling this table I have to know, if there are some double values in it.
How can I do this on the easiest way with the most performance.

thanks a lot for your quick answer.
bye
Foehni
 
Hi Foe,

"Double values"? Kind of vague. Do you mean:


123456
789485
789485
789542
.
.
etc

If so, you can try this:

If the table is not sorted, you'll have to perform an in-core sort first, creating a sorted table. Then you can scan sorted table (up to entry 49) using:

IF TBL-ENT(IND +1) = TBL-ENT(IND)
DISPLAY 'GOTCHA!!!'
END-IF

You can find the dupes w/o sorting the table but you'd have to scan the table 49 times. If the table appears (w/different values) in each I/P rec you're processing, performance issues may kill this approach.

However, if the table is constant for the execution of your pgm, I'd do the searches once, outside the process loop and create a new table w/a dupe indicator, then proceed as above, e.g.:

IF TBL-DUP-IND(IND) = '*'
DISPLAY 'GOTCHA!!!'
END-IF


HTH, Jack.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top