Hi,
I know we should not - but the question is, Why can't we use occur clause in 01 group level? Is there any explnation apart from it being a rule?
Why can't we use occur clause in 01 group level?
-
- New Member
- Posts: 4
- Joined: Mon Oct 13, 2014 11:15 am
- Robert Sample
- Global Moderator
- Posts: 1891
- Joined: Fri Jun 28, 2013 1:22 am
- Location: Dubuque Iowa
Re: Why can't we use occur clause in 01 group level?
Actually, the fact that it is a rule is enough of a reason.
However, the Programming Guide points out that a table definition with the OCCURS must be subordinate to a group name -- and since that cannot occur with an 01 level, OCCURS cannot be put on an 01 level variable. And if you want to know why the table must be subordinate to a group name -- that is the rule.
You need to learn to accept what the rules are and use them without worrying about why things are how they are. Sometimes the explanation is available, but sometimes it is not -- remember that COBOL came about more than 50 years ago, so the reasons for some of the language constructs are not necessarily easy to determine now.
However, the Programming Guide points out that a table definition with the OCCURS must be subordinate to a group name -- and since that cannot occur with an 01 level, OCCURS cannot be put on an 01 level variable. And if you want to know why the table must be subordinate to a group name -- that is the rule.
You need to learn to accept what the rules are and use them without worrying about why things are how they are. Sometimes the explanation is available, but sometimes it is not -- remember that COBOL came about more than 50 years ago, so the reasons for some of the language constructs are not necessarily easy to determine now.
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