Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist 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 HEX value search in a DB2 query maxsubrat DB2 2 Wed Oct 04, 2017 3:04 pm
No new posts Search for a string in many PDS KARTHIGADEVI CLIST & REXX 5 Fri Sep 08, 2017 2:32 pm
No new posts Match two files using multiple keys a... santoshks1987 SYNCSORT 11 Fri Aug 18, 2017 10:50 am
No new posts Search utility(3.14) using JCl and Cobol RKS3 COBOL Programming 12 Sat Jun 10, 2017 10:24 pm
No new posts Record Not found in AlX but record re... mukun264 COBOL Programming 7 Fri Mar 24, 2017 9:28 am

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us