When we use index and when we use subscipt?

OS/VS COBOL, COBOL II, Enterprise COBOL for z/OS. OpenCOBOL and OOCobol.
Post Reply
Sushil Vaidya
Registered Member
Posts: 15
Joined: Wed Dec 18, 2013 11:19 pm

When we use index and when we use subscipt?

Post by Sushil Vaidya »

Hello,

When we use index and when we use subscipt in a COBOL program?
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: When we use index and when we use subscipt?

Post by Robert Sample »

You cannot use indexes without specifying INDEXED BY on the table definition. So the first rule of thumb is that if you don't have INDEXED BY, you are using subscripts. In general, indexes and subscripts can be used as the programmer wants but there are exceptions. If your program uses SEARCH ALL, your program will require indexes and not subscripts for that statement.
William Collins
Global Moderator
Global Moderator
Posts: 490
Joined: Sun Aug 25, 2013 7:24 pm

Re: When we use index and when we use subscipt?

Post by William Collins »

Search this forum. You will find longer discussion on the subject.
Sushil Vaidya
Registered Member
Posts: 15
Joined: Wed Dec 18, 2013 11:19 pm

Re: When we use index and when we use subscipt?

Post by Sushil Vaidya »

Thanks Robert.
If your program uses SEARCH ALL, your program will require indexes and not subscripts for that statement.
I read on other online reference a similar statement and the question I've is - if we're not using SEARCH ALL -- index and subscript are just same, theortically?
Sushil Vaidya
Registered Member
Posts: 15
Joined: Wed Dec 18, 2013 11:19 pm

Re: When we use index and when we use subscipt?

Post by Sushil Vaidya »

William Collins wrote:Search this forum. You will find longer discussion on the subject.
Thanks looked at other topic too and got more to learn.
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.”