View previous topic :: View next topic |
Author |
Message |
ravikumar_sri2001 Beginner
Joined: 06 Dec 2002 Posts: 117 Topics: 44 Location: Chennai,India
|
Posted: Sat Apr 16, 2005 1:42 am Post subject: Subscript Vs Index |
|
|
Hi Gurus,
I got the following information from FAQ section of this site.
"To calculate the displacement of the table entry from its beginning when subscript is used takes 16 additional instructions from the system because of that the usage of the index is more efficient. "
How many instructions does it take for Index to calculate displacement of the table entry from the beginning of the table ?.
Thansks,
Ravikumar. |
|
Back to top |
|
|
kolusu Site Admin
Joined: 26 Nov 2002 Posts: 12376 Topics: 75 Location: San Jose
|
Posted: Sat Apr 16, 2005 9:14 am Post subject: |
|
|
Quote: |
How many instructions does it take for Index to calculate displacement of the table entry from the beginning of the table ?.
|
ravikumar_sri2001,
Using indexes to address a table is more efficient than using subscripts since the index already contains the displacement from the start of the table and does not have to be calculated at run time. Subscripts, on the other hand, contain an occurrence number that must be converted to a displacement value at run time before it can be used. When using subscripts to address a table, use a binary (COMP) signed data item with eight or fewer digits (for example, using PICTURE S9(8 ) COMP for the data item). This will allow fullword arithmetic to be used during the calculations. Additionally, in some cases, using four or fewer digits for the data item may also offer some added reduction in CPU time since halfword arithmetic can be used.
Hope this helps...
Cheers
Kolusu _________________ Kolusu
www.linkedin.com/in/kolusu |
|
Back to top |
|
|
ravikumar_sri2001 Beginner
Joined: 06 Dec 2002 Posts: 117 Topics: 44 Location: Chennai,India
|
Posted: Mon Apr 18, 2005 7:38 am Post subject: |
|
|
Kolusu,
Thanks much for your reply.
Thanks,
Ravikumar. |
|
Back to top |
|
|
|
|