IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Continue SEARCH ALL after a match found


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
jtwohig

New User


Joined: 24 Jul 2006
Posts: 18

PostPosted: Tue Mar 13, 2007 11:00 pm
Reply with quote

Hi,

Is there a way I can do a SEARCH ALL whereby the search continues after a match ? If there is more than one match I want to perform one set of instructions but if there is only one match, another set of instructions.

Thanks,
J.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


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

PostPosted: Tue Mar 13, 2007 11:40 pm
Reply with quote

Hi J,

I don't believe so.

In fact, one of the requirements for a successful "SEARCH ALL" is that the items be unique.
From the Fine Manual:
Quote:
The results of a SEARCH ALL operation are predictable only when:

The data in the table is ordered in ASCENDING/DESCENDING KEY order

The contents of the ASCENDING/DESCENDING keys specified in the WHEN clause provide a unique table reference.


Which says that if you do not have unique items, you may get a wrong answer.

To do what you want, i'd suggest starting at the beginning and if the table value goes greater that your argument value, it is a no-hit. If you "hit" once, increment to the next and see if they are equal. If so, you have your multiple case - if not it is the single hit case. For this, the table soule also need to be in sequence.
Back to top
View user's profile Send private message
jtwohig

New User


Joined: 24 Jul 2006
Posts: 18

PostPosted: Wed Mar 14, 2007 7:17 pm
Reply with quote

Thanks Dick. I decided to do a PERFORM...VARYING instead and am in the process of testing that.
Thanks,
J.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


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

PostPosted: Wed Mar 14, 2007 7:46 pm
Reply with quote

You're welcome icon_smile.gif

We're here if you have any new "opportunities". . .
Back to top
View user's profile Send private message
TG Murphy

Active User


Joined: 23 Mar 2007
Posts: 148
Location: Ottawa Canada

PostPosted: Mon Mar 26, 2007 9:21 pm
Reply with quote

I have seen a program do a SEARCH ALL and then continue with a small sequential search. The data in the table looked like this: Sample data:

Emp Effective Expiry Salary

Joe 2001-01-01 2003-09-23 $40,000
Joe 2003-09-23 9999-12-31 $42,000

I recall that once the SEARCH ALL found a match on Joe, it would follow up with a sequential search (it would search forward and backward as needed) - the purpose of the additional sequential search was to find the row that was currently effective.
Back to top
View user's profile Send private message
livingston

New User


Joined: 20 Feb 2007
Posts: 6
Location: India

PostPosted: Wed Apr 18, 2007 2:38 pm
Reply with quote

hi
we cannot find more than one matches using SEARCH ALL. For doing so you can go for PERFORM UNTIL....
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts How I Found a Bug in a FORTRAN Compiler All Other Mainframe Topics 4
No new posts Search two or more word with FILEAID Compuware & Other Tools 15
No new posts Sortjoin and Search for a String and ... DFSORT/ICETOOL 1
No new posts first column truncated in search result IBM Tools 13
No new posts ISRSUPC search utility - using high l... TSO/ISPF 2
Search our Forums:

Back to Top