IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Why OCCURS clause other than 01 level


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
raghav08
Currently Banned

New User


Joined: 03 Jun 2008
Posts: 94
Location: Bangalore

PostPosted: Tue Sep 28, 2010 3:29 pm
Reply with quote

Hi,

Why do we need to declare OCCURS clause other than 01 level ? Any specific reason, please.

(I could not see any past discussion on this, if any please provide.)

Thanks.
Back to top
View user's profile Send private message
Bill O'Boyle

CICS Moderator


Joined: 14 Jan 2008
Posts: 2501
Location: Atlanta, Georgia, USA

PostPosted: Tue Sep 28, 2010 3:40 pm
Reply with quote

Because that's the COBOL rule, plain and simple....

Bill
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Tue Sep 28, 2010 4:07 pm
Reply with quote

one way to look at this:

a table item is addressed
Quote:

as a displacement from the beginning of the table


according to the manual, a table is defined within a group item with an occurs clause.
if the occurs clause were to be declared at the 01 level, there would be no group item,
thus no beginning of table resolution.

another perspective:

01 represents a logical record. Occurs clause is used to repeat fields with same format, not the records.
Back to top
View user's profile Send private message
raghav08
Currently Banned

New User


Joined: 03 Jun 2008
Posts: 94
Location: Bangalore

PostPosted: Tue Sep 28, 2010 4:16 pm
Reply with quote

Hi.

The second answer sounds good.

Quote:

01 represents a logical record. Occurs clause is used to repeat fields with same format, not the records.


Thanks
Back to top
View user's profile Send private message
Phrzby Phil

Senior Member


Joined: 31 Oct 2006
Posts: 1042
Location: Richmond, Virginia

PostPosted: Tue Sep 28, 2010 5:07 pm
Reply with quote

But the first answer is the answer to your question.

The 2nd answer is the answer to the question: "Why did the COBOL committee require this restriction in the language definition?"

Both good questions.
Back to top
View user's profile Send private message
mmwife

Super Moderator


Joined: 30 May 2003
Posts: 1592

PostPosted: Fri Oct 01, 2010 4:58 am
Reply with quote

Hi raghav,

It may be that they wanted to assure that they always provided something to reference the ENTIRE table, e.g. for a MOVE.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts How to load to DB2 with column level ... DB2 6
No new posts ISRSUPC search utility - using high l... TSO/ISPF 2
No new posts To search DB2 table based on Conditio... DB2 1
No new posts Updating a 1 byte thats in occurs mul... DFSORT/ICETOOL 6
No new posts JPM Reports for each DB2 V12 Function... DB2 0
Search our Forums:

Back to Top