View previous topic :: View next topic
|
Author |
Message |
preethan Warnings : 1 New User
Joined: 15 Dec 2008 Posts: 33 Location: Chennai
|
|
|
|
May be this is a silly question. But I am not getting a easy solution for it.
I have two rows in an internal table. Let A,B,C be the field names
A B C
3 5 3
4 2 1
3 5 3
Now I'm using search variable in cobol. I am searching for the field 'A'. Lets assume that I'm searching if the field A has value as 3. There are two rows here. I want to exit the search when the first hit is found. I don't want the search to be performed even after getting hold of the first row. In simple terms I need to exit the search finding the first hit. |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Have you tried to code it? What happened? How do you interpret what the manual says? |
|
Back to top |
|
|
Craq Giegerich
Senior Member
Joined: 19 May 2007 Posts: 1512 Location: Virginia, USA
|
|
|
|
Do a sequential search not a "search all". |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
The thing is, as Craq has said, if you do a plain SEARCH it will do what you want, ie only find the first "5" and then stop searching.
This is what it says in the manual. If you are not getting that behaviour, then we need to see your code (definitions of all the data and the SEARCH statement itself).
If you are having a problem, the easiest error to make is not to set up the initial condition for the search. Check what it says in the manual, check against your code.
If you are still having a problem, post the stuff requested (in the Code tags, please) and we can see what we can do. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Quote: |
I have two rows in an internal table. Let A,B,C be the field names
A B C
3 5 3
4 2 1
3 5 3 |
I see 3 "rows".
How have you set up the SEARCH? The array?
At the top of the page is a link t "IBM Manuals". The first set of manuals id for COBOL. Look at the Language Reference for your level of COBOL.
If you find something that is not clear, post what you found and your doubt. Someone will be able to clarify. |
|
Back to top |
|
|
|