Display index in COBOL.

OS/VS COBOL, COBOL II, Enterprise COBOL for z/OS. OpenCOBOL and OOCobol.
Post Reply
Anshul Gupta
New Member
Posts: 5
Joined: Sun Apr 27, 2014 10:51 am

Display index in COBOL.

Post by Anshul Gupta »

Hi,

Can the index be moved to a display-able field? Is there any way to display the value in an index in COBOL?
William Collins
Global Moderator
Global Moderator
Posts: 490
Joined: Sun Aug 25, 2013 7:24 pm

Re: Display index in COBOL.

Post by William Collins »

What does the Enterprise COBOL Language Reference say that you can do with an index (assuming you mean the INDEXED BY field)? Identifying what you can't do should lead you to something you can do.
User avatar
Robert Sample
Global Moderator
Global Moderator
Posts: 1895
Joined: Fri Jun 28, 2013 1:22 am
Location: Dubuque Iowa
United States of America

Re: Display index in COBOL.

Post by Robert Sample »

Is there any way to display the value in an index in COBOL?
You are asking a VERY fuzzy question here. When you want to display the value of an index, do you want to display
- the actual address (which is 8 hexadecimal digits)?
- the offset into the table (which would be a hexadecimal value starting at zero and going up by the table length)?
- the element number being referenced (i.e., a subscript value)?

There are good arguments to be made for each of these three possibilities.
Anshul Gupta
New Member
Posts: 5
Joined: Sun Apr 27, 2014 10:51 am

Re: Display index in COBOL.

Post by Anshul Gupta »

Thanks. Robert, Third point of yours is what I'm after.
Post Reply

Create an account or sign in to join the discussion

You need to be a member in order to post a reply

Create an account

Not a member? register to join our community
Members can start their own topics & subscribe to topics
It’s free and only takes a minute

Register

Sign in

Return to “IBM COBOL, GnuCOBOL (OpenCOBOL), OOCobol.”