Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SEARCH ALL question. 4

Status
Not open for further replies.

wolves

Programmer
Jan 26, 2001
130
US
Question, when I do a SEARCH ALL, I pass a file which I load into and internal table, it's 35,000 rows, I am looking for a match in this table with an input file, I get no matches.

Now, when I take the same exact input file, except delete the last 15K rows, so now my internal table is 20K rows, I run the program, nothing changed, but now I do get my matches?

is there a limit on the SEARCH ALL?

My internal table is defined as such:

Code:
05  WS-TBL-TBL
        OCCURS  1 TO 40000  TIMES
        DEPENDING  ON  WS-TBL-ENTRIES
        ASCENDING KEY  IS  WS-TABLE-NUM, WS-TABLE-SUFF
        INDEXED  BY  WS-TBL-INDX   WS-TBL-MAX.
    10  WS-TABLE-NUM                PIC X(12) VALUE SPACES.
    10  WS-TABLE-IN                 PIC X(02) VALUE SPACES.
    10  WS-TABLE-IT                 PIC X(04) VALUE SPACES.
    10  WS-TABLE-DATE               PIC X(08) VALUE SPACES.

So I know it works for looking for my match because I do get a match with the smaller file?????
 
Can you place your current search all code, your current COBOL vendor and version, and OS vendor and version also.

In your code please include the initialization of all table variables, including the code that loads the table entries.

Also regarding your code WS-TABLE-SUFF is not on your table layout.

And as a minor note, when ever I have more than one field used as a key I place that within a group
e.g.
05 WS-TBL-TBL
OCCURS 1 TO 40000 TIMES
DEPENDING ON WS-TBL-ENTRIES
ASCENDING KEY IS WS-TABLE-KEY
INDEXED BY WS-TBL-INDX WS-TBL-MAX.
10 WS-TABLE-KEY.
15 WS-TABLE-NUM PIC X(12) VALUE SPACES.
15 WS-MY-OTHER-KEY-FIELD PIC X(10) VALUE SPACES.
10 WS-TABLE-IN PIC X(02) VALUE SPACES.


and similiarily I load the values I am searching to an identical group.

Regards

Frederico Fonseca
SysSoft Integrated Ltd
 
On a mainframe, 390.
(PP 5648-A25 IBM COBOL FOR OS/390 & VM 2.1.2)



Changed the WS-TBL-TBL a bit, had a wrong field name.

Code:
05  WS-TBL-TBL
        OCCURS  1 TO 40000  TIMES
        DEPENDING  ON  WS-TBL-ENTRIES
        ASCENDING KEY  IS  WS-TABLE-NUM, WS-TABLE-IN
        INDEXED  BY  WS-TBL-INDX   WS-TBL-MAX.
    10  WS-TABLE-NUM                PIC X(12) VALUE SPACES.
    10  WS-TABLE-IN                 PIC X(02) VALUE SPACES.
    10  WS-TABLE-IT                 PIC X(04) VALUE SPACES.
    10  WS-TABLE-DATE               PIC X(08) VALUE SPACES.


SEARCH  ALL  WS-TBL-TBL
 AT END
   SET  WS-TBL-NOT-FND-ON-TBLLIST TO TRUE
 WHEN WS-TBL-NUM(WS-TBL-INDX) EQUAL WS-INFILE-NUM
    AND WS-TBL-IN(WS-TBL-INDX) EQUAL WS-INFILE-IN
   SET  WS-TBL-FND-ON-TBLLIST   TO  TRUE
END-SEARCH.

Did I forget anything?

 
Yes they are. The file is run thru a sort job that sorts the first 14 rows.

Also, since my smaller file of 20K rows works, I assume all is fine also. The difference between the large and small file is the last 15K rows.
 
How are you initializing WS-TBL-ENTRIES before and during the laod of the table?


Also can you try and change
ASCENDING KEY IS WS-TABLE-NUM, WS-TABLE-IN
INDEXED BY WS-TBL-INDX WS-TBL-MAX.
10 WS-TABLE-NUM PIC X(12) VALUE SPACES.
10 WS-TABLE-IN PIC X(02) VALUE SPACES.

to
ASCENDING KEY IS WS-TABLE-KEY
INDEXED BY WS-TBL-INDX WS-TBL-MAX.
10 WS-TABLE-KEY
15 WS-TABLE-NUM PIC X(12) VALUE SPACES.
15 WS-TABLE-IN PIC X(02) VALUE SPACES.

01 WS-INFILE-KEY.
05 WS-INFILE-NUM-tst PIC X(12).
05 WS-INFILE-IN-tst PIC X(02).

move Ws-INFILE-NUM TO Ws-INFILE-NUM-TST
move Ws-INFILE-IN TO Ws-INFILE-IN-TST
SEARCH ALL WS-TBL-TBL
AT END
SET WS-TBL-NOT-FND-ON-TBLLIST TO TRUE
WHEN WS-TBL-KEY(WS-TBL-INDX) EQUAL WS-INFILE-KEY
SET WS-TBL-FND-ON-TBLLIST TO TRUE
END-SEARCH.


Just to see if it makes any difference.

Regards

Frederico Fonseca
SysSoft Integrated Ltd
 
How many recs are in the 2nd file?

Regards, Jack.

"A problem well stated is a problem half solved" -- Charles F. Kettering
 
Yes, it's a typo, the file is sorted by all 26 bytes.
I will try your suggestion to see what I come up with.
Thanks for the advice.

How many recs are in the 2nd file?
Do you mean that I am checking against the internal table?
Because that file is 13 million rows.

 
Here is the error that I get:



Code:
CEE3204S The system detected a protection exception (System Completion Code=0C4)
From compile unit PROGRAM1 at entry point PROGRAM1 at compile unit offset +00002BFC at address 16E0393C.
 
Did you set your index(s) to 1 before the SEARCH ALL?
 
1. You don't need to set your indices before a SEARCH ALL

2. Is is possible that WS-TBL-ENTRIES is an S9(4) COMP field and hence can't hold a value larger than 32768?

Regards.

Glenn
 
Maybe something is corrupt in the file or you are loading the table incorrectly and this makes the search think that you have reached the end of the table. You might have the search indicated the ending position and then print out the table elements around that point. It appears the program thinks it reached the end of the table when it did not. The obvious answer is there is something wrong in the middle of the table to make the search all to stop.


Every element in the table must be a unique occurrance of the index.

If you do not like my post feel free to point out your opinion or my errors.
 
When you have a protection exception (S-0C4) it usually means that you are referencing an area outside of the table. Can't you look at the dump produced and see the value of the index at the time of the abend?
 
I would also suggest compiling with SSRANGE and seeing if you have a subscript problem.

Bill Klein
 
[slightly off-topic]
Let met guess: this program occupies a lot of space in your loadlib pds? Takes a long time to load?
Try this
Code:
[b]01[/b]  WS-TBL-TBL [b]external[/b].
The reserved space for your table in not included in the load-module anymore but will be allocated (above the 16m line if I remember well) at execution time.
[/slightly off-topic]
Search problem not solved yet? Just try a SEARCH instead of SEARCH ALL just for analysis purpose. Just to see if the table is filled and specified correctly.

And how about "3gm"'s idea about the S9(4) COMP field? It makes sence to me. So much that I give him a start for that.
 
For now, I changed it to a SEARCH and that works fine, so I am ruling out data issues for the data is correct in and out.

I am going back to revisit the SEARCH ALL with all your replies above and will post my findings. Thanks again everyone and look for my reply after my testing.

 
If the search works then I would create a small perform like the following
Code:
perform varying my-counter from 2 by 1
  until my-counter > WS-TBL-ENTRIES 
  IF WS-TABLE-NUM(my-counter) = WS-TABLE-NUM(my-counter - 1)
  AND WS-TABLE-IN(my-counter) < WS-TABLE-IN(my-counter - 1)
      DISPLAY "Error on Index: " my-counter
  END-IF
  IF WS-TABLE-NUM(my-counter) < WS-TABLE-NUM(my-counter - 1)
      DISPLAY "Error on Index: " my-counter
  END-IF
end-perform.
where my-counter is a pic 9(8)

and place it after you have loaded the table.
If you get a display then your data has not been sorted properly, and therefore the search all will not perform correctly either.


Regards

Frederico Fonseca
SysSoft Integrated Ltd
 
Thanks for the tip fredericonfonseca. Saved that piece of code for future use.

The answer was:

2. Is is possible that WS-TBL-ENTRIES is an S9(4) COMP field and hence can't hold a value larger than 32768?

I cannot I overlooked this part after looking at every part of the table and sorted data.

Thanks for the experience.
 
3gm,
As fine a piece of troubleshooting as I've seen in a long time. Have a star.

Tranman

"Adam was not alone in the Garden of Eden, however,...much is due to Eve, the first woman, and Satan, the first consultant." Mark Twain
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top