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

Search All Error, not a key of the table being searched


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

New User


Joined: 18 Jun 2008
Posts: 54
Location: Colombo

PostPosted: Tue Jun 26, 2012 6:24 pm
Reply with quote

Hi,

I am getting an error when using SEARCH ALL. Please see below and help me. Thanks.

WORKING-STORAGE SECTION.

01 WS-NAME PIC X(5).

01 INT-TABLE.
05 BUMKT OCCURS 10 TIMES ASCENDING KEY DATA1 INDEXED BY WS-SUB1.
10 DATA1.
15 NAME PIC X(5).
15 LOCATION PIC X(5).


PROCEDURE DIVISION.

SEARCH ALL BUMKT
AT END
DISPLAY 'MATCH NOT FOUND'
WHEN NAME = WS-NAME
DISPLAY LOCATION
END-SEARCH.


Error Message:


The left side operand, "NAME (ALPHANUMERIC)", of a "WHEN"
phrase of a "SEARCH ALL" statement was not a key of the table being
searched. The statement was discarded.
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8697
Location: Dubuque, Iowa, USA

PostPosted: Tue Jun 26, 2012 6:26 pm
Reply with quote

The message tells you exactly what is wrong. You defined DATA1 as your key -- so your SEARCH ALL must use DATA1, not NAME, for your WHEN clause. SEARCH ALL does not support partial key searches.
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Tue Jun 26, 2012 6:34 pm
Reply with quote

Define some good datanames, please. I'm surprised "NAME" isn't already RESERVED, but it could be someday. Surely the contents of your data are not the only thing worthy of the word NAME in the entire world, so why not describe them a bit better and help out the next person who looks at your program (and you in a week's time) so that they know what "NAME" is.
Back to top
View user's profile Send private message
cvijay784
Warnings : 1

New User


Joined: 18 Jun 2008
Posts: 54
Location: Colombo

PostPosted: Tue Jun 26, 2012 6:34 pm
Reply with quote

Thanks for your reply. Can i have more than 1 field as table key?
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Tue Jun 26, 2012 6:35 pm
Reply with quote

Isn't it easy enough to look in the manual? Toss in a compile yourself?
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8697
Location: Dubuque, Iowa, USA

PostPosted: Tue Jun 26, 2012 6:46 pm
Reply with quote

Your question is not clear as worded.

If you are asking whether more than one variable can be specified as the table keys, the answer is yes -- but you must load the table in the correct sequence based on all the keys.

If you are asking whether the ASCENDING (DESCENDING) KEY IS phrase can reference a group variable, the answer is a qualified yes. The manual indicates that a group variable used as a table key cannot have an OCCURS clause nor can it contain any OCCURS DEPENDING ON on any subordinate level.
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 Error to read log with rexx CLIST & REXX 11
No new posts Load new table with Old unload - DB2 DB2 6
No new posts Error when install DB2 DB2 2
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
Search our Forums:

Back to Top