View previous topic :: View next topic
|
Author |
Message |
saroragu
New User
Joined: 12 Nov 2008 Posts: 22 Location: india
|
|
|
|
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 |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8696 Location: Dubuque, Iowa, USA
|
|
|
|
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 |
|
|
saroragu
New User
Joined: 12 Nov 2008 Posts: 22 Location: india
|
|
|
|
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 |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
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 |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8696 Location: Dubuque, Iowa, USA
|
|
|
|
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 |
|
|
saroragu
New User
Joined: 12 Nov 2008 Posts: 22 Location: india
|
|
|
|
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 |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
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 |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
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 |
|
|
saroragu
New User
Joined: 12 Nov 2008 Posts: 22 Location: india
|
|
|
|
Thanks a lot for providing this detail. |
|
Back to top |
|
|
|