Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Why OCCURS clause other than 01 level

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
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    Post subject: Why OCCURS clause other than 01 level
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: 2504
Location: Atlanta, Georgia, USA

PostPosted: Tue Sep 28, 2010 3:40 pm    Post subject: Reply to: OCCURS LEVEL
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: 6968
Location: porcelain throne

PostPosted: Tue Sep 28, 2010 4:07 pm    Post subject:
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    Post subject: Reply to: OCCURS LEVEL
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

Active Member


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

PostPosted: Tue Sep 28, 2010 5:07 pm    Post subject:
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    Post subject:
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    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Need help on SQL Dynamic WHERE Clause subratarec DB2 12 Sat Jul 16, 2016 3:11 pm
No new posts Syncsort TPF Level Majid Hussain SYNCSORT 2 Wed Apr 13, 2016 2:22 am
No new posts Need a logic to validate the data in ... sandeep kumar302 COBOL Programming 17 Mon Feb 01, 2016 3:30 pm
No new posts [SQL0029] INTO clause missing from em... HABBIE DB2 2 Fri Sep 04, 2015 3:54 pm
No new posts Multiple OCCURS depending on in same ... muralirajansm COBOL Programming 6 Fri Aug 21, 2015 4:23 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us