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

SEARCH ALL result when the input data is not sorted


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

New User


Joined: 27 Mar 2006
Posts: 68

PostPosted: Fri Apr 13, 2007 4:07 pm
Reply with quote

I am using SEARCH ALL in one of my program. For SEARCH ALL, the data should be in Ascending or decending order. I just want to know, if we dont sort the data, will we get any error or the SEARCH ALL does not function properly.
Back to top
View user's profile Send private message
dnreddy

New User


Joined: 08 Dec 2006
Posts: 8
Location: chennai

PostPosted: Fri Apr 13, 2007 4:37 pm
Reply with quote

Hi ravi

SEARCH - is a serial search.

SEARCH ALL - is a binary search & the table must be sorted ( ASCENDING/DESCENDING KEY clause to be used & data loaded in this order) before using SEARCH ALL.

What should be the sorting order for SEARCH ALL
It can be either ASCENDING or DESCENDING. ASCENDING is default. If you want the search to be done on an array sorted in descending order, then while defining the array, you should give DESCENDING KEY clause. (You must load the table in the specified order).

Back to top
View user's profile Send private message
ravikumar15

New User


Joined: 27 Mar 2006
Posts: 68

PostPosted: Fri Apr 13, 2007 4:42 pm
Reply with quote

I know that. My question is, suppose if the data is not sorted, will we get error.
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3156
Location: Tucson AZ

PostPosted: Fri Apr 13, 2007 4:42 pm
Reply with quote

From the Language Reference
Quote:
The results of a SEARCH ALL operation are predictable only when:
v The data in the table is ordered in ASCENDING/DESCENDING KEY order
v The contents of the ASCENDING/DESCENDING keys specified in the WHEN clause provide a unique table reference.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


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

PostPosted: Fri Apr 13, 2007 6:54 pm
Reply with quote

Hello,

Follow the Search rules or possibly get invalid results - it may not actually fail, just give the wrong result. There is no suppose the data is not sorted.
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 How to save SYSLOG as text data via P... All Other Mainframe Topics 1
No new posts TRIM everything from input, output co... DFSORT/ICETOOL 1
No new posts Store the data for fixed length COBOL Programming 1
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts Search two or more word with FILEAID Compuware & Other Tools 15
Search our Forums:

Back to Top