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.
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.
Joined: 31 Jan 2008 Posts: 38 Location: Chennai, India
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
Joined: 14 Jan 2008 Posts: 345 Location: Orlando, FL, USA
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).
Joined: 07 Jun 2005 Posts: 60 Location: South Africa
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.
Joined: 23 Nov 2006 Posts: 8768 Location: 221 B Baker St
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: