Hi,
What is the answer for the question, the Occurs 0 times in OCCURS DEPENDING ON is acceptable or not? I think it is allowed but I was not sure about the answer. But if it is given how the table will look like?
Occurs 0 times in OCCURS DEPENDING ON.
-
- New Member
- Posts: 1
- Joined: Fri Dec 12, 2014 3:47 pm
Re: Occurs 0 times in OCCURS DEPENDING ON.
Have you looked it up in the manual? You should have before posting. So what is it in the manual that you do not understand?
Regards
Nic
Nic
- Akatsukami
- Global Moderator
- Posts: 122
- Joined: Tue Oct 20, 2015 3:20 am
- Location: Bloomington, IL
- Contact:
Re: Occurs 0 times in OCCURS DEPENDING ON.
As the variable-length tables topic of the Enterprise COBOL for z/OS Language Reference manual states:
The value of integer-1 must be greater than or equal to zero
"I come to the conclusion that, men loving according to their own will and fearing according to that of the prince, a wise prince should establish himself on that which is in his own control and not in that of others." -- Niccolò Machiavelli
- Robert Sample
- Global Moderator
- Posts: 1896
- Joined: Fri Jun 28, 2013 1:22 am
- Location: Dubuque Iowa
Re: Occurs 0 times in OCCURS DEPENDING ON.
Zero is allowed because OCCURS DEPENDING ON can be used in an FD and the file may very well have no occurrences.
As for how the table will look, that depends upon where the table is located. In an FD or LINKAGE SECTION, the table will look like nothing because there will be no entries in it. In WORKING-STORAGE, since COBOL allocates the entire table in memory the table will look the same as if every element was defined.
As for how the table will look, that depends upon where the table is located. In an FD or LINKAGE SECTION, the table will look like nothing because there will be no entries in it. In WORKING-STORAGE, since COBOL allocates the entire table in memory the table will look the same as if every element was defined.
-
- Global Moderator
- Posts: 490
- Joined: Sun Aug 25, 2013 7:24 pm
Re: Occurs 0 times in OCCURS DEPENDING ON.
Code: Select all
01 some-table.
05 some-non-OCCURS-stuff PIC X(10).
05 the-OCCURS-BIT.
10 FILLER OCCURS 0 TO 30 TIMES
DEPENDING ON number-of-actual-entries-at-the-time.
15 the-data-entry PIC XX.
OCCURS DEPENDING ON with 0 TO ... has many uses.
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