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
 

 

linear search in array

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
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    Post subject: linear search in array
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    Post subject: Re: linear search in array
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    Post subject: Re: linear search in array
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    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 Dynamic array request/response contai... Suja.Sai CICS 2 Tue Jan 24, 2017 11:37 am
No new posts Unstring list of values into an array. Roshnii COBOL Programming 8 Mon Jun 27, 2016 6:25 pm
No new posts Search a Load Module sreekanth1984 TSO/ISPF 8 Tue Jun 07, 2016 8:45 pm
No new posts Copy one PDS to another PDS based on ... alluri12 JCL & VSAM 10 Tue Sep 29, 2015 8:10 pm
No new posts COBOL Program to Read Array data raj4neo COBOL Programming 8 Sat Aug 15, 2015 12:28 am


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