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
 

 

Continue SEARCH ALL after a match found

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
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    Post subject: Continue SEARCH ALL after a match found
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

Site Director


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

PostPosted: Tue Mar 13, 2007 11:40 pm    Post subject:
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    Post subject:
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

Site Director


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

PostPosted: Wed Mar 14, 2007 7:46 pm    Post subject:
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: 149
Location: Ottawa Canada

PostPosted: Mon Mar 26, 2007 9:21 pm    Post subject:
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    Post subject:
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    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 Match or compare two files in VB Format anatol DFSORT/ICETOOL 14 Thu Nov 03, 2016 7:41 pm
This topic is locked: you cannot edit posts or make replies. Job to wait and continue based on reply yugendran COBOL Programming 5 Wed Oct 05, 2016 1:46 pm
No new posts Not enough virtual memory is availabl... Vinay Pushpala IBM Tools 16 Tue Sep 13, 2016 4:37 pm
No new posts Search a Load Module sreekanth1984 TSO/ISPF 8 Tue Jun 07, 2016 8:45 pm
No new posts DFSORT to match two files and write John F Dutcher DFSORT/ICETOOL 6 Thu May 12, 2016 5:17 pm


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