View previous topic :: View next topic |
Author |
Message |
Subzero Beginner
Joined: 02 Dec 2002 Posts: 19 Topics: 7 Location: Chennai, India
|
Posted: Wed Mar 22, 2006 5:35 am Post subject: Index with more than 4 bytes |
|
|
Hi,
I am struck up with a problem of having a very big COBOL table of 99999 items but cannot use index because the number of items (5 bytes) is more than what an index could accomodate (4 bytes). Is there a way to specify full-word index instead of a half-word index?
Cheers,
SubZero |
|
Back to top |
|
 |
kolusu Site Admin

Joined: 26 Nov 2002 Posts: 12376 Topics: 75 Location: San Jose
|
Posted: Wed Mar 22, 2006 5:37 am Post subject: |
|
|
Subzero,
Why not define your own index item ?
Kolusu _________________ Kolusu
www.linkedin.com/in/kolusu |
|
Back to top |
|
 |
Subzero Beginner
Joined: 02 Dec 2002 Posts: 19 Topics: 7 Location: Chennai, India
|
Posted: Wed Mar 22, 2006 6:25 am Post subject: |
|
|
Kolusu,
Do you mean using subscripts? Or if i use a variable defined with USAGE IS INDEX, can that accomodate 99999 items? I know you would not be happy with me asking this without reading manuals, but can you elaborate on using own index item?
Cheers,
SubZero |
|
Back to top |
|
 |
kolusu Site Admin

Joined: 26 Nov 2002 Posts: 12376 Topics: 75 Location: San Jose
|
Posted: Wed Mar 22, 2006 8:33 am Post subject: |
|
|
Subzero,
Look at the following sample
Code: |
WORKING-STORAGE SECTION.
01 TEST-KEY.
05 NUM-TBL OCCURS 1200000 TIMES
ASCENDING KEY UNQ-NUM INDEXED BY IDX.
10 UNQ-NUM PIC 9(08).
01 WS-NUM PIC 9(08) VALUE 1.
PROCEDURE DIVISION.
PERFORM VARYING IDX FROM 1 BY 1
UNTIL IDX > 1200000
MOVE WS-NUM TO UNQ-NUM(IDX)
ADD +1 TO WS-NUM
END-PERFORM
PERFORM VARYING IDX FROM 1000000 BY 1
UNTIL IDX > 1000030
DISPLAY UNQ-NUM(IDX)
END-PERFORM
GOBACK.
|
Hope this helps....
Cheers
Kolusu _________________ Kolusu
www.linkedin.com/in/kolusu |
|
Back to top |
|
 |
Subzero Beginner
Joined: 02 Dec 2002 Posts: 19 Topics: 7 Location: Chennai, India
|
Posted: Wed Mar 22, 2006 9:17 am Post subject: |
|
|
Thanks Kolusu, the question sounds silly in the hindsight.
Cheers,
SubZero |
|
Back to top |
|
 |
|
|