View previous topic :: View next topic
|
Author |
Message |
parampunit
New User
Joined: 04 Oct 2008 Posts: 6 Location: US
|
|
|
|
Hi,
I need some help in definition of OCCURS clause, it involves multiple Occurs with Depending on clause.
We need to store the data for 13 months (so first array), and for each month the data for each department (2nd array). This gets tricky as the number of departments varies for each month and can be upto 200. Also the number of months of history is variable, it cane be from 1 thru 13.
I am pasting a sample (hope it comes out fine as this is my first post) but this will not work because of COBOL constraints. Need some input on how to handle this situation:
Code: |
10 RECORD-ID.
15 KEY1 PIC S9(09) COMP-3.
15 KEY2 PIC S9(11) COMP-3.
15 MAX-NO-OF-MONTH PIC S9(04) COMP.
10 DYNAMIC-AREA-A.
15 A-DATA OCCURS 1 TO 13
DEPENDING ON
MAX-NO-OF-MONTH.
20 A-DATA-DETAIL PIC X(100).
10 DYNAMIC-AREA-B.
15 B-DATA OCCURS 1 TO 13
DEPENDING ON
MAX-NO-OF-MONTH.
20 B-DATA-STATIC PIC X(10).
20 NO-OF-DEPTS PIC S9(05) COMP-3.
20 B-DATA-OCCURS OCCURS 0 TO 200
DEPENDING ON
NO-OF-DEPTS.
25 B-DATA-DETAIL PIC X(200).
|
|
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello and welcome to the forum,
One way would be to forego the "depending on".
Simply declare the problem "occurs" as the max. In the code make sure you honor the limits. |
|
Back to top |
|
|
parampunit
New User
Joined: 04 Oct 2008 Posts: 6 Location: US
|
|
|
|
Thanks for the quick reply. Hope I can get answers and contribute in this fourm.
If I define the area with Max occurs, the data area for Area B will be around 78K. Area A is also about 1100 bytes in my actual copybook. so I have around 1100*13 (Area A) and 78K for Area B, which will be around 93K for just this copybook.
This copybook is passed in many programs along with a bunch of other copybooks thru Linkage area.
I have concerns that we may reach the limits.
Rgds,
Param |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello Param,
Quote: |
Hope I can get answers and contribute in this fourm. |
We'd like that also. . .
Quote: |
This copybook is passed in many programs |
Usually, when a sub-program is called, there is no duplication of the "passed" data. What is usually passed is the address of the original set of data in the calling module.
Quote: |
I have concerns that we may reach the limits. |
At the top of the page is a link to "IBM Manuals". There are COBOL Language Reference manuals for 3 current compilers. In the one in use on your system, search (the flashlight at the top left) for "compiler limits". If i remember, the limit for an array on my system is about 16meg. . .
Good luck and someone will be here when there are questions. |
|
Back to top |
|
|
Terry Heinze
JCL Moderator
Joined: 14 Jul 2008 Posts: 1249 Location: Richfield, MN, USA
|
|
|
|
Exterprise COBOL can handle an 01 level size of 128M minus 1 so you have plenty of wiggle room. |
|
Back to top |
|
|
Terry Heinze
JCL Moderator
Joined: 14 Jul 2008 Posts: 1249 Location: Richfield, MN, USA
|
|
|
|
Oops, I mean enterprise. I guess I should start using the Spellcheck. |
|
Back to top |
|
|
parampunit
New User
Joined: 04 Oct 2008 Posts: 6 Location: US
|
|
|
|
Thanks!!!
If there is no other alternative I will define the 2nd occurs to have the max value. |
|
Back to top |
|
|
|