View previous topic :: View next topic
|
Author |
Message |
lavanya
New User
Joined: 08 Jul 2005 Posts: 8
|
|
|
|
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 |
|
|
shivashunmugam Muthu
Active User
Joined: 22 Jul 2005 Posts: 114 Location: Chennai
|
|
|
|
Hi Lavanya,
You have to set the value for your index. Say start from 1. Hav u done that? |
|
Back to top |
|
|
shivashunmugam Muthu
Active User
Joined: 22 Jul 2005 Posts: 114 Location: Chennai
|
|
|
|
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 |
|
|
|