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

"Search All" Not Working.


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
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
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
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: 218
Location: India

PostPosted: Wed Apr 16, 2008 1:36 pm
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
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: 218
Location: India

PostPosted: Wed Apr 16, 2008 2:01 pm
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
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 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 PuTTY - "User is not a surrogate... IBM Tools 5
No new posts PD not working for unsigned packed JO... DFSORT/ICETOOL 5
No new posts Def PD not working for unsigned packe... JCL & VSAM 3
Search our Forums:

Back to Top