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

Hi give me the example for index-displacement in no of bytes


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

New User


Joined: 27 Jun 2008
Posts: 33
Location: CHENNAI

PostPosted: Mon Jun 30, 2008 3:00 pm
Reply with quote

Hi i know the difference between index and subscript in theoritically.
but what is displacement in no of bytes in index?
can u give me the example for me to undersatnd.

Regards,
apsara.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


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

PostPosted: Mon Jun 30, 2008 8:55 pm
Reply with quote

Hello,

Quote:
but what is displacement in no of bytes in index?
can u give me the example for me to undersatnd.
You have probably not received a reply because your question is not yet understood.

Please clarify "displacement" in your question. What sort of example will help you?

There is a link at the top of the page named "IBM Manuals". The following is from a COBOL manual linked there:

publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/handheld/Connected/BOOKS/igy3pg20/8.1.3

It is what you are looking for. If you fnd something that is not clear, post what you found and your question(s) about it. Somone will be able to explain.
Back to top
View user's profile Send private message
murugan_mf

Active User


Joined: 31 Jan 2008
Posts: 148
Location: Chennai, India

PostPosted: Tue Jul 01, 2008 8:29 pm
Reply with quote

Diaplacemrent is nothing but the number of bytes it traversed to reach that value

For example you have declared a table as:
Code:
01 tab ,
 02 v1 pic 99 occurs 10 times indexed by i1.


If you try to access v1(2) means , internally the displacement will be 4 bytes as each will allocate 2 bytes.But it doesn't matter how internally it will takes just using indexed is more efficient and no need to declare the variable
Back to top
View user's profile Send private message
Bill O'Boyle

CICS Moderator


Joined: 14 Jan 2008
Posts: 2501
Location: Atlanta, Georgia, USA

PostPosted: Wed Jul 02, 2008 5:00 am
Reply with quote

FWIW, an INDEX is an aligned binary-fullword stored in the TGT (Task Global Table of the given program) and used by the program when array/table addressing is needed.

It is the best method for addressing data in an array and is a REQUIREMENT if the array is defined with a KEY in ASCENDING or DESCENDING order (for use with a SEARCH ALL).

Bill
Back to top
View user's profile Send private message
donevin

New User


Joined: 07 Jun 2005
Posts: 70
Location: South Africa

PostPosted: Wed Jul 02, 2008 12:19 pm
Reply with quote

Hi Bill

Where can I get hold of documentation that explains these kind of neat stuff like TGT's and so on? I have been a COBOL programmer for some time and would like to take my skills to the next level but have difficulty in finding the applicable information. Thanks in advance for your reply.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


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

PostPosted: Wed Jul 02, 2008 9:12 pm
Reply with quote

Hello,

At the top of the page, there is a link called "IBM Manuals". The following is from the Enterprise COBOL Programming Guide (there are multiple linked and your version should be) linked there:

publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/handheld/Connected/BOOKS/igy3pg20/2.6.3.7.8

This is more complete info on the memory mapping of the TGT.

Much other info is in the Programming Guide as well.
Back to top
View user's profile Send private message
donevin

New User


Joined: 07 Jun 2005
Posts: 70
Location: South Africa

PostPosted: Thu Jul 03, 2008 6:53 pm
Reply with quote

This helps a lot. Thanks Dick.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


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

PostPosted: Thu Jul 03, 2008 9:49 pm
Reply with quote

You're welcome - good luck icon_smile.gif

d
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 Concatenate 2 input datasets and give... JCL & VSAM 2
No new posts why displacement of 12 on STM PL/I & Assembler 3
No new posts Cobol file using index COBOL Programming 2
No new posts Masking variable size field - min 10 ... DFSORT/ICETOOL 4
No new posts DL/I status code AK for GU call using... IMS DB/DC 1
Search our Forums:

Back to Top