MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Restrict Linear search

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming
View previous topic :: View next topic  
Author Message
gans79
Beginner


Joined: 31 Aug 2005
Posts: 51
Topics: 27

PostPosted: Tue Aug 22, 2006 11:32 pm    Post subject: Restrict Linear search Reply with quote

hi,
I've a question on Linear seach,i have a table of size 100 but it will not be loaded with data completely, & while performing a search i want to restrict the search such that it searches the table with valid data, & be more efficient,

Thanks
Ganesh
Back to top
View user's profile Send private message
mahapatrasoumya
Beginner


Joined: 21 Aug 2006
Posts: 8
Topics: 2
Location: Chennai

PostPosted: Wed Aug 23, 2006 1:08 am    Post subject: Reply with quote

define your table with a depending on clause so that while loading ur table it only loaded as much as your data is. Keep incrementing the value of subscript till ur exhaust all record that have to be loaded.

thanks
Back to top
View user's profile Send private message
mahapatrasoumya
Beginner


Joined: 21 Aug 2006
Posts: 8
Topics: 2
Location: Chennai

PostPosted: Wed Aug 23, 2006 2:51 am    Post subject: Reply with quote

Hi gans79,


If you define your table with an indexed by clause even without a depending clause and then do alinear search with the SEARCH keyword your job is done.

Because SEARCH does a linear search and stops as soon as it finds the first occurence of an element.

Thanks,
Soumya
Back to top
View user's profile Send private message
shekar123
Advanced


Joined: 22 Jul 2005
Posts: 528
Topics: 90
Location: Bangalore India

PostPosted: Wed Aug 23, 2006 4:46 am    Post subject: Reply with quote

gans79,

Here in this case if we have a table say with 10 elements and values are already assigned and if we want to find whether the element A1 is found in one of the 10 table entries,we can use this code for serial search.If the element is not found we are displaying as not found and if it found we are displaying as found.
[code:1:80e70f5d7a]
SEARCH TABLE-ENTRY
AT END
MOVE 4 TO RETURN-CODE
DISPLAY 'ELEMENT NOT FOUND'
WHEN TABLE-ENTRY(WS-INDEX) =
_________________
Shekar
Grow Technically
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group