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
 

 

"Search All" Not Working.

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

New User


Joined: 13 Feb 2008
Posts: 7
Location: India

PostPosted: Tue Apr 15, 2008 5:56 pm    Post subject: "Search All" Not Working.
Reply with quote

Hi all,


I have a requirement in which I have to load the data from a file into an array. The process is to read the second file and search for the data in the loaded array.

The data is sorted and I am using the first index for the Search all function. The code looks like below.


Code:
SEARCH ALL TABLE-ENTRIES
  WHEN OFFICE(T-INDX) EQUAL TO WS-OFFICE AND
       ACCTNO(T-INDX) EQUAL TO WS-ACCTNO AND
       SECNO(T-INDX)  EQUAL TO WS-SECNO
       DISPLAY 'INSIDE THE SEARCH'
END-SEARCH.




Here if I use search instead of search all the code is working fine and I am getting the expected results. Can anyone please point out what needs to be done to resolve this issue?

Note that the data in both the files are sorted by the Keys in the table definition and I am not at all getting any displays in the sysout. I am reading the second file to a layout exactly similar to OFFICE thru INTL-RATE

The definition for the table looks like

Code:
07 TABLE-ENTRIES            OCCURS 20000 TIMES
                            ASCENDING KEY IS OFFICE
                            ASCENDING KEY IS ACCTNO
                            ASCENDING KEY IS SECNO
                            INDEXED BY T-INDX.
    10 OFFICE          PIC S9(4) COMP-3.
    10 ACCTNO          PIC S9(8) COMP-3.
    10 SECNO           PIC X(9).
    10 INTL-RATE       PIC S9(7)V99 COMP-3.
Back to top
View user's profile Send private message

dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Tue Apr 15, 2008 6:33 pm    Post subject:
Reply with quote

have you loaded 20000 items into the table?

if not, you need to use an ODO clause.

and why have you coded it this way:
Code:

ASCENDING KEY IS OFFICE
ASCENDING KEY IS ACCTNO
ASCENDING KEY IS SECNO


and not this way?
Code:

ASCENDING KEY IS OFFICE ACCTNO SECNO

Back to top
View user's profile Send private message
sri_mf

Active User


Joined: 31 Aug 2006
Posts: 216
Location: India

PostPosted: Wed Apr 16, 2008 1:36 pm    Post subject:
Reply with quote

dbzTHEdinosauer wrote:
have you loaded 20000 items into the table?

if not, you need to use an ODO clause.

[/code]


can u explain this ODO clause..n wats its use
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Wed Apr 16, 2008 1:53 pm    Post subject:
Reply with quote

ODO - occurs depending on

part of the syntax for cobol internal table definitions.


You define a table with item(s) occcuring 1 to 100 times depending on var.
where var is a numeric item representing the number of items.

If a 'search all' is not bounded by an ODO clause, then the complete size of the table is taken into consideration. With the ODO clause, only active items are searched.

example:

odo 1 to 100 depending on var-1.

var-1 = 43. The search-all will only search 43 items. starting with item 26 or 27.

In the case of a 100 item fixed lengh table that only contains 43 items, a search-all will start with item 50, which contains ?. That is possibly why the OP is not getting a hit.
Back to top
View user's profile Send private message
sri_mf

Active User


Joined: 31 Aug 2006
Posts: 216
Location: India

PostPosted: Wed Apr 16, 2008 2:01 pm    Post subject:
Reply with quote

dbzTHEdinosauer wrote:
ODO - occurs depending on
.


Thanks for ur reply dick..I know Occurs depending On..

Onseeing ODO i thought that its something else...n it confused me..
Gud word ODO.. icon_biggrin.gif
Back to top
View user's profile Send private message
Anil George

New User


Joined: 13 Feb 2008
Posts: 7
Location: India

PostPosted: Wed Apr 16, 2008 3:27 pm    Post subject: :)
Reply with quote

Thanks a lot Dick. That solved my issue entirely. I was struggling with this one for the last 24 hrs and I even coded a small pgm to test the functionality. I have made all the changes that you have told me and the pgm is just working fine….

Thanks once again Dick…. You just made my day!!! icon_biggrin.gif

Anil
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 SQL query not working in Cobol program. CuriousMainframer COBOL Programming 14 Wed Feb 22, 2017 5:56 pm
No new posts Amount field is getting corrupted whe... thesumitk SYNCSORT 5 Tue Oct 18, 2016 8:20 pm
No new posts hot to get details when "EXEC CI... Andi1982 CICS 11 Tue Sep 20, 2016 5:01 pm
No new posts SCRNAME not working on my mainframe? mrsidhu12 TSO/ISPF 7 Thu Sep 01, 2016 2:17 pm
No new posts Multi row fetch - "for read only... Nileshkul DB2 3 Sun Aug 14, 2016 12:52 am


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