Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Level of using "OCCURS" clause

Status
Not open for further replies.

oferico

Programmer
Jul 4, 2004
1
IL
Can i use the "OCCURS" clause at level 01 definition ?
 
That is not possible.

Didn't you just try it out with your compiler?

Regards,

Crox
 
I believe there's no problem doing this. AcuCOBOL accepts this definition and I cannot see any limitation on this in the COBOL documentation I have handy.

It is a rather odd situation where you would not want this table to be subordinate to another data name (for instance, to INITIALIZE the table).

Glenn Mitchell
Brainbench MVP for COBOL II
 
3gm,

I am not familiar with AcuCOBOL so I cannot comment on it being OK as far as containing an OCCURS clause in the 01 level data definition; but I will agree that is rather odd!

My question however is: can you not define a table under a 01-level (and said table is the only item under said 01-level) and then INITIALIZE the 01-level dataname?

Regards.

winzip
 
An occurs on a 01-level, makes it a little bit more difficult to use that 01-level in a using option.

Also a redefines is not easy. How do you refer to the group? With a wild-card?

01 iznogood pic x occurs 10.
01 redefines iznogood(*)??????????

This is not normal and not good COBOL, even when AcuCOBOL likes to handle it, it is not exchangable with an other compiler.

Or does anyone knows of an other compiler that accepts this?

Regards,

Crox


 
I've seen a couple of compilers that will accept this, but recommend you avoid coding OCCURS on the 01, because it is not standard, and therefore not portable. Betty Scherber
Brainbench MVP for COBOL II
 
To answer the question recently asked:

"My question however is: can you not define a table under a 01-level (and said table is the only item under said 01-level) and then INITIALIZE the 01-level dataname?"

The answer is: Yes.

01 Some-Table.
03 Table-Entries Occurs 10 times.
05 Some-Stuff Pic X(20).

Then:

Initialize Some-Table.
 
Thane,

That was rhetorical question... I knew perfectly well the answer to it. That is why you'd note that it was addressed not to the originator of the thread, rather to someone who was attempting an answer and who, in his post said the following:

'It is a rather odd situation where you would not want this table to be subordinate to another data name (for instance, to INITIALIZE the table).'

Hence the rhetorical question where I implicitly mean that one can INDEED define a table subordinate to a 01-level and then initialize said 01 level!

Thanks for the response anyway.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top