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

Search all to be sorted explicitly


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
suraaj

New User


Joined: 16 Apr 2009
Posts: 69
Location: Canada

PostPosted: Tue Apr 23, 2013 12:09 am
Reply with quote

Hi

I am having a table of 2000 items and I am loading the table depending on the value of a key say count. Once the table is loaded I am searching for an entry in the table against a value in a file. If they match I have to write it in a file. The file has ten records. The issue that I am facing is that the ten records from the file is only being matched with the first record. I am using SEARCH ALL...I see that this as a case of index non-initialization. I even tried with initialization still no success. Kindly help.
Back to top
View user's profile Send private message
don.leahy

Active Member


Joined: 06 Jul 2010
Posts: 765
Location: Whitby, ON, Canada

PostPosted: Tue Apr 23, 2013 12:13 am
Reply with quote

Is the table in the correct sort sequence?
Back to top
View user's profile Send private message
suraaj

New User


Joined: 16 Apr 2009
Posts: 69
Location: Canada

PostPosted: Tue Apr 23, 2013 12:15 am
Reply with quote

I have defined the table using the ascending key. So when the table is loaded it is in ascending sequence
Back to top
View user's profile Send private message
Craq Giegerich

Senior Member


Joined: 19 May 2007
Posts: 1512
Location: Virginia, USA

PostPosted: Tue Apr 23, 2013 12:23 am
Reply with quote

suraaj wrote:
I have defined the table using the ascending key. So when the table is loaded it is in ascending sequence


No, did you load the table with the keys in the correct sequence, how the table is defined in COBOL does not mean the data is in the correct sequence, you have to ensure that when you load the data!
Back to top
View user's profile Send private message
Bill O'Boyle

CICS Moderator


Joined: 14 Jan 2008
Posts: 2501
Location: Atlanta, Georgia, USA

PostPosted: Tue Apr 23, 2013 12:24 am
Reply with quote

Is the table fixed-length or variable-length (OCCURS DEPENDING ON)?

The table-data must be in sorted-order before you load it. COBOL will NOT ensure it's sorted as this is the programmer's responsibility.

Move HIGH-VALUES to the table before you load the sorted table-entries. Then if the number of entries is less than 2000, you'll have HIGH-VALUES at the end of the table, ensuring the SEARCH ALL will work.

What will you do if the number of table-entries exceeds 2000 at O'Dark thirty in the morning? icon_eek.gif

Where are you getting the table-data?

You might be better off defining the table to LINKAGE, where you can create a Dynamic-Table (via CEEGTST), based upon knowing the number of entries beforehand.

When defined in LINKAGE, you can define the table as a true ODO, 1 to 1677721 TIMES and allow an additional PIC 9(09) COMP variable, which represents the actual number of table entries.

For example -

Code:

    03  WS-STG-LGTH        PIC 9(09) COMP.
LINKAGE SECTION.
01  LS-DYNAMIC-TBL.
    03  LS-DYNAMIC-OCCURS  PIC 9(09) COMP.
    03  LS-DYNAMIC-ENTRIES OCCURS 1 TO 1677721 TIMES
                           DEPENDING ON LS-DYNAMIC-OCCURS
                           INDEXED BY X-LS-DT, X-LS-DT-MAX
                           PIC X(10).
Back to top
View user's profile Send private message
suraaj

New User


Joined: 16 Apr 2009
Posts: 69
Location: Canada

PostPosted: Tue Apr 23, 2013 1:34 am
Reply with quote

The issue is reolved. I had not taken into consideration that the table has to be sorted explicitly. The table is created using depending on so that the table remains just enough long to contain the number of elements present.
Thanks for the solution Craq Giegerich
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 first column truncated in search result IBM Tools 13
No new posts ISRSUPC search utility - using high l... TSO/ISPF 2
No new posts To search DB2 table based on Conditio... DB2 1
Search our Forums:

Back to Top