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

linear search in array


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

New User


Joined: 08 Jul 2005
Posts: 8

PostPosted: Tue Aug 02, 2005 10:16 am
Reply with quote

hi,

can we search for an item in the file which is an a table-array format using search syntax.when i tried its always showing "NOT FOUND'.

the file structure,

FD DAT-FILE.
01 DAT-REC.
03 DAT-TABLE OCCURS 2 TIMES INDEXED BY I.
05 NUM PIC 9(3).
05 MARK1 PIC 9(3).
05 MARK2 PIC 9(3).
05 FILLER PIC X(71).

the search syntax

SEARCH DAT-TABLE AT END DISPLAY 'NOT FOUND'
WHEN N IS EQUAL TO NUM(I)
DISPLAY 'MARK1 ',MARK1(I).


clarify my doubt,

thanks,
lavanya
Back to top
View user's profile Send private message
shivashunmugam Muthu

Active User


Joined: 22 Jul 2005
Posts: 114
Location: Chennai

PostPosted: Tue Aug 02, 2005 11:22 am
Reply with quote

Hi Lavanya,

You have to set the value for your index. Say start from 1. Hav u done that?
Back to top
View user's profile Send private message
shivashunmugam Muthu

Active User


Joined: 22 Jul 2005
Posts: 114
Location: Chennai

PostPosted: Tue Aug 02, 2005 11:27 am
Reply with quote

If your table sorted one in the particular key order(Index Key), u dont need to SET the index. You can do SEARCH ALL option. Its called Binary search. In the prev case, what I told is serial search where SETting the index is the must & do only 'SEARCH' nt search all
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 Search two or more word with FILEAID Compuware & Other Tools 15
No new posts Sortjoin and Search for a String and ... DFSORT/ICETOOL 1
No new posts first column truncated in search result IBM Tools 13
No new posts ISRSUPC search utility - using high l... TSO/ISPF 2
No new posts To search DB2 table based on Conditio... DB2 1
Search our Forums:

Back to Top