View previous topic :: View next topic
|
Author |
Message |
niks_jude Warnings : 1 Active User
Joined: 01 Dec 2006 Posts: 144 Location: Mumbai
|
|
|
|
I have a basic question to ask about indexing -- in indexing if I have to refer certain index can I access it by the bytes displacement or is it related to occurence number only? |
|
Back to top |
|
|
prakash271082
New User
Joined: 09 Sep 2005 Posts: 53
|
|
|
|
Hi,
Index is always incremented by Bytes Displacement, whereas the subscripts-by occurance number. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Keep in mind that it is valid to code:
PERFORM para VARYING THE-INDEX FROM 1 BY 1 UNTIL. . . .
Internally, bytes are used by the index, but your code might be coded as the example. |
|
Back to top |
|
|
Harish-Ramakrishnan
New User
Joined: 10 Mar 2006 Posts: 3 Location: MUMBAI
|
|
|
|
Can i use something like the below while using the index?
Move constant to WS-table-entry(1).
Its working for me for the condition i wanted. But please let me know if it is correct? |
|
Back to top |
|
|
dr_te_z
New User
Joined: 08 Jun 2007 Posts: 71 Location: Zoetermeer, the Netherlands
|
|
|
|
Harish-Ramakrishnan wrote: |
But please let me know if it is correct? |
Yes. Nothing wrong there. |
|
Back to top |
|
|
Anuj Dhawan
Superior Member
Joined: 22 Apr 2006 Posts: 6250 Location: Mumbai, India
|
|
|
|
Hi,
Browsed through the manuals, here is something to share..
INDEXEs: An item is identified as an INDEX to a given table thru the INDEXED BY option of the OCCURS clause. As shown by Dick
Quote: |
PERFORM para VARYING THE-INDEX FROM 1 BY 1 UNTIL. . . |
In this case, the item identified as an index can be used (for the specific table with which it is associated thru the INDEXED BY phrase)exactly as if it were a subscript, with the following exceptions:
- the initial value of an index cannot be defined; it must be given
an initial value before it is used as a subscript
- the value of an index can be set or modified only by a PERFORM,
SEARCH, or SET statement.
Furtner,
- As an IBM extension, any index can be used to reference any table.
- Each index-name specifies an index to be created by the compiler for use by the program. These index-names are not data-names and are not identified elsewhere in the COBOL program; instead, they can be regarded as private special registers for the use of this object program only. They are not data and are not part of any data hierarchy.
- Unreferenced index names need not be uniquely defined.
- In one table entry, up to 12 index-names can be specified.
- If a data item that possesses the global attribute includes a table accessed with an index, that index also possesses the global attribute. Therefore, the scope of an index-name is the same as that of the data-name that names the table in which the index is defined.
INDEXED BY phrase
This phrase is part of the OCCURS clause, The INDEXED BY phrase specifies the indexes that can be used with a table. A table without an INDEXED BY phrase can be referred to through indexing by using an index-name associated with another table.
..& as previously said..
Quote: |
Move constant to WS-table-entry(1). |
It's right. |
|
Back to top |
|
|
|