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
 

 

Could you please give me example of 'SEARCH ALL' Statement

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
Amolondhe007
Warnings : 1

New User


Joined: 16 Apr 2007
Posts: 50
Location: Pune

PostPosted: Wed Sep 24, 2008 7:04 pm    Post subject: Could you please give me example of 'SEARCH ALL' Statement
Reply with quote

Hi,

I'm expecting example of 'SEARCH ALL' Statement with description.

Thanks,
Amol Londhe
Back to top
View user's profile Send private message

Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Wed Sep 24, 2008 7:53 pm    Post subject:
Reply with quote

look at this one
Code:

01 DESC.                                               
   02 ARR PIC X(26) VALUE 'ABCDEFGHIJKLMNOPQRSHUVWXYZ'.
   02 ARR1 REDEFINES ARR PIC X(1) OCCURS 26 TIMES     
                              ASCENDING KEY IS ARR1   
                              INDEXED BY IDX.         
.
.
    SET IDX TO 1.                                     
    SEARCH ALL ARR1 AT END DISPLAY 'LETTER NOT FOUND'
    WHEN ARR1(IDX) = 'H'                             
    SET POS TO IDX                                   
    DISPLAY 'LETTER IS FOUND AT: '  POS               
    END-SEARCH.                                       
Back to top
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Wed Sep 24, 2008 8:02 pm    Post subject:
Reply with quote

Sorry one correction to string value
Change string value to 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' replace second H by T and run.

while doing comparision
for first time 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'

2nd time 'ABCDEFGHIJKLM'

3rd time 'GHIJKLM'
And so on.. GHI...AND H FINALLY
Back to top
View user's profile Send private message
kalpana manoharan84
Currently Banned

New User


Joined: 18 Sep 2008
Posts: 4
Location: Chennai

PostPosted: Wed Sep 24, 2008 8:11 pm    Post subject: Reply to: Could you please give me example of 'SEARCH ALL' S
Reply with quote

Hi,
when using SEARCH ALL verb, its not mandatory to set the Index variable -IDX [given in the example code] to an initial value.

Please note the requirements for a successful SEARCH ALL:
1] Internal Table should be in sorted ASCENDING/DESCENDING
SEQUENCE by KEY
2] Key values must be unique
3] Table must have a KEY IS clause in addition to an INDEXED BY clause
4] OCCURS (n) TIMES should match valid table elements

Hope this might be helpful.
Back to top
View user's profile Send private message
Anuj Dhawan

Senior Member


Joined: 22 Apr 2006
Posts: 6258
Location: Mumbai, India

PostPosted: Wed Sep 24, 2008 8:19 pm    Post subject:
Reply with quote

Hi,

Please search the forum before posting, here are some similar topics:

http://www.ibmmainframes.com/viewtopic.php?t=33202&highlight=search
http://www.ibmmainframes.com/viewtopic.php?t=32772&highlight=search
http://www.ibmmainframes.com/viewtopic.php?t=29907&highlight=search
http://www.ibmmainframes.com/viewtopic.php?t=28869&highlight=search
http://www.ibmmainframes.com/viewtopic.php?t=29377&highlight=search
http://www.ibmmainframes.com/viewtopic.php?t=28520&highlight=search
http://www.ibmmainframes.com/viewtopic.php?t=26256&highlight=search
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 Search utility(3.14) using JCl and Cobol RKS3 COBOL Programming 12 Sat Jun 10, 2017 10:24 pm
No new posts scheduling between OPC and TWS give u... nsbl IBM Tools 4 Sun Mar 12, 2017 5:35 pm
No new posts ROUNDED Problem with COMPUTE statement shalem COBOL Programming 11 Thu Feb 09, 2017 8:16 pm
No new posts VALIDATE NULL VALUE IN DB2 CASE STATE... useit DB2 5 Thu Feb 09, 2017 4:34 pm
No new posts -913/-911 Deadlock during UPDATE stat... NoSleep319 DB2 5 Fri Nov 18, 2016 12:37 am


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