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
 

 

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

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
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    Post subject: Search All Error, not a key of the table being searched
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: 7931
Location: Bellevue, IA

PostPosted: Tue Jun 26, 2012 6:26 pm    Post subject:
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7251

PostPosted: Tue Jun 26, 2012 6:34 pm    Post subject: Reply to: Search All Error
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    Post subject: Reply to: Search All Error
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7251

PostPosted: Tue Jun 26, 2012 6:35 pm    Post subject: Reply to: Search All Error
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: 7931
Location: Bellevue, IA

PostPosted: Tue Jun 26, 2012 6:46 pm    Post subject:
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    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 OO COBOL compile error Virendra Shambharkar COBOL Programming 3 Tue Jan 10, 2017 6:05 pm
No new posts SQL query to run through list of valu... Ni3-db2 DB2 14 Wed Dec 14, 2016 9:52 am
No new posts S922 Error yuvan ABENDS & Debugging 3 Fri Dec 02, 2016 6:58 pm
No new posts Invoke Webservice Fails with DFHPI100... divated CICS 2 Thu Nov 24, 2016 5:57 pm
No new posts Error during restore rename archanamuthukrishnan All Other Mainframe Topics 2 Fri Oct 14, 2016 3:30 pm


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