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

What is index incremented by?


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

Active User


Joined: 01 Dec 2006
Posts: 144
Location: Mumbai

PostPosted: Mon Dec 10, 2007 1:34 pm
Reply with quote

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
View user's profile Send private message
prakash271082

New User


Joined: 09 Sep 2005
Posts: 53

PostPosted: Mon Dec 10, 2007 5:28 pm
Reply with quote

Hi,

Index is always incremented by Bytes Displacement, whereas the subscripts-by occurance number.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Tue Dec 11, 2007 5:01 am
Reply with quote

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
View user's profile Send private message
Harish-Ramakrishnan

New User


Joined: 10 Mar 2006
Posts: 3
Location: MUMBAI

PostPosted: Thu Dec 13, 2007 8:43 am
Reply with quote

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
View user's profile Send private message
dr_te_z

New User


Joined: 08 Jun 2007
Posts: 71
Location: Zoetermeer, the Netherlands

PostPosted: Thu Dec 13, 2007 12:07 pm
Reply with quote

Harish-Ramakrishnan wrote:
But please let me know if it is correct?
Yes. Nothing wrong there.
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6250
Location: Mumbai, India

PostPosted: Thu Dec 13, 2007 1:07 pm
Reply with quote

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
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 Cobol file using index COBOL Programming 2
No new posts DL/I status code AK for GU call using... IMS DB/DC 1
No new posts Add column to existing records using ... JCL & VSAM 2
No new posts choice of clustering index DB2 3
No new posts Secondary index error while loading d... IMS DB/DC 2
Search our Forums:

Back to Top