View previous topic :: View next topic
|
Author |
Message |
emonmisra
New User
Joined: 10 Jul 2006 Posts: 7 Location: Bangalore
|
|
|
|
HI,
Have u ever come across the situation where one Index of internal table is compared with a working storage variable.
Warning: ???????????? removed from Titile |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
Hello,
Yes, it is fairly common. . . |
|
Back to top |
|
|
emonmisra
New User
Joined: 10 Jul 2006 Posts: 7 Location: Bangalore
|
|
|
|
Hi,
But index is not variable. this is displacement. we can even dispaly the value of index. How it can be comapred like
RBASSC-DRIVERX > WS-TOTAL-DRIVERS-INEXP |
|
Back to top |
|
|
Craq Giegerich
Senior Member
Joined: 19 May 2007 Posts: 1512 Location: Virginia, USA
|
|
|
|
emonmisra wrote: |
Hi,
But index is not variable. this is displacement. we can even dispaly the value of index. How it can be comapred like
RBASSC-DRIVERX > WS-TOTAL-DRIVERS-INEXP |
COBOL will convert the index to an occurence number and do a numeric compare. |
|
Back to top |
|
|
William Thompson
Global Moderator
Joined: 18 Nov 2006 Posts: 3156 Location: Tucson AZ
|
|
Back to top |
|
|
Craq Giegerich
Senior Member
Joined: 19 May 2007 Posts: 1512 Location: Virginia, USA
|
|
|
|
That would be more efficient but you have to remember to set the index data item to a displacement and not an occurence. |
|
Back to top |
|
|
CICS Guy
Senior Member
Joined: 18 Jul 2007 Posts: 2146 Location: At my coffee table
|
|
|
|
If you look at table 24, you will see that an index-name can be compared toa numeric interger (data-name or literal) and it will compare the occurance number of the index-name..... |
|
Back to top |
|
|
Sandy Zimmer
Active Member
Joined: 13 Jun 2007 Posts: 826 Location: Wilmington, DE
|
|
|
|
This is an example of why it is easier to track a subscript (defined in ws) as opposed to an index. Indices are horrible to debug and terrible to find in a dump. Susbscripts are much more manageable. |
|
Back to top |
|
|
Craq Giegerich
Senior Member
Joined: 19 May 2007 Posts: 1512 Location: Virginia, USA
|
|
|
|
Sandy Zimmer wrote: |
This is an example of why it is easier to track a subscript (defined in ws) as opposed to an index. Indices are horrible to debug and terrible to find in a dump. Susbscripts are much more manageable. |
But indexes are more efficient. |
|
Back to top |
|
|
Sandy Zimmer
Active Member
Joined: 13 Jun 2007 Posts: 826 Location: Wilmington, DE
|
|
|
|
Really? I do think that has been disproven. Besides, which is cheaper - lately - hardware or programmers? I always opt for a compromise. |
|
Back to top |
|
|
CICS Guy
Senior Member
Joined: 18 Jul 2007 Posts: 2146 Location: At my coffee table
|
|
|
|
Well, Sandy, I guess we can all agree where you stand on the index/subscript question....grin....
As far as efficiency goes, it depends.....indexes are recalculated each time they are incremented while subscripts are calculated upon reference to the data item in the table.
They both have their place, but you can't SEARCH without indexes.... |
|
Back to top |
|
|
Sandy Zimmer
Active Member
Joined: 13 Jun 2007 Posts: 826 Location: Wilmington, DE
|
|
|
|
Well, CICS Guy - maybe you cannot search without an index, but the way I do it, I can search with a subscript. I have done it for years. I just do not use SEARCH or SEARCH ALL. I just check the values as I go thru the table. Remember that the table must be in sequence. When I hit a value greater than what I am looking for, or I find what I am looking for, or I'm at the end of the table. I end the search. Maybe I just like the control? |
|
Back to top |
|
|
CICS Guy
Senior Member
Joined: 18 Jul 2007 Posts: 2146 Location: At my coffee table
|
|
|
|
Sandy Zimmer wrote: |
Maybe I just like the control |
Good for you.....And I never said that you couldn't search a table..... |
|
Back to top |
|
|
|