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

multidimensional table using occurs clause


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

New User


Joined: 12 Nov 2008
Posts: 22
Location: india

PostPosted: Tue Feb 24, 2009 3:51 pm
Reply with quote

Any one please explain about the multi dimensional occurs clause. I studied that the dimension is upto 7 times. Please explain me on this little bit elaborately.
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Tue Feb 24, 2009 4:16 pm
Reply with quote

It's not clear what you're asking -- are you wanting to know the syntax of using multiple OCCURS clauses (in which case, the manuals link at the top of the page takes you to the COBOL Language Reference which will explain in complete detail), or why someone would want to use multiple OCCURS clauses (such as a report layout giving values for page, row, column -- 3 OCCURS clauses needed)?
Back to top
View user's profile Send private message
saroragu

New User


Joined: 12 Nov 2008
Posts: 22
Location: india

PostPosted: Tue Feb 24, 2009 4:47 pm
Reply with quote

please provide with syntax for this example
Code:

01 Rooms
   20 Cupboards
      30 racks
         40 books
            50 Pages
               60 rows
                  70 columns


Is it possible to have this much number of dimensions in occurs clause and what is the maximum limit I want to know.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


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

PostPosted: Tue Feb 24, 2009 4:59 pm
Reply with quote

no, each demension is defined by an occurs clause.

The documentation about your compiler will tell you the number of demesions that you can define.
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Tue Feb 24, 2009 5:08 pm
Reply with quote

Quote:
Is it possible to have this much number of dimensions in occurs clause and what is the maximum limit I want to know.
At the top of the page, there is a link to manuals. Click on it, find the COBOL manual for your system, and review the compiler limits section. What you're asking is in the manuals.
Back to top
View user's profile Send private message
saroragu

New User


Joined: 12 Nov 2008
Posts: 22
Location: india

PostPosted: Tue Feb 24, 2009 5:10 pm
Reply with quote

Code:

01 books-details.
   20 Rooms                       pic 9(02) occurs 2 times.
   20 Cupboards                  pic 9(02) occurs 2 times.
   20 racks                        pic 9(02) occurs 2 times.
   20 books                         pic 9(02) occurs 2 times.
   20 Pages                        pic 9(02) occurs 2 times.
   20 rows                         pic 9(02) occurs 2 times.
   20 columns                    pic 9(02) occurs 2 times.

Is this syntax is correct?
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


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

PostPosted: Tue Feb 24, 2009 5:18 pm
Reply with quote

saroragu,
you have 7 one demensional tables within the structure Book-details.

if you increase the level-numbers, then each new level will represent a new demension.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Tue Feb 24, 2009 8:25 pm
Reply with quote

Hello,

Quote:
Is this syntax is correct?
It would compile, but is probably not what you want. . .

It is better to have a requirement and then find a solution for it rather than have a solution and go looking for a requirement so it can be used. Keep in mind that a multi-dimensional array is not a requirement (unless it is a school assignment). The solution would meet some business need. Arrays might help implementing the solution.
Back to top
View user's profile Send private message
saroragu

New User


Joined: 12 Nov 2008
Posts: 22
Location: india

PostPosted: Wed Feb 25, 2009 9:07 am
Reply with quote

Thanks a lot for providing this detail.
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 Load new table with Old unload - DB2 DB2 6
No new posts Pulling a fixed number of records fro... DB2 2
No new posts Multiple table unload using INZUTILB DB2 2
No new posts Check data with Exception Table DB2 0
No new posts Dynamically pass table name to a sele... DB2 2
Search our Forums:

Back to Top