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

Help on Multiple "Occurs Depending On"


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

New User


Joined: 04 Oct 2008
Posts: 6
Location: US

PostPosted: Fri Feb 13, 2009 4:08 am
Reply with quote

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
View user's profile Send private message
dick scherrer

Moderator Emeritus


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

PostPosted: Fri Feb 13, 2009 4:19 am
Reply with quote

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
View user's profile Send private message
parampunit

New User


Joined: 04 Oct 2008
Posts: 6
Location: US

PostPosted: Fri Feb 13, 2009 6:49 am
Reply with quote

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
View user's profile Send private message
dick scherrer

Moderator Emeritus


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

PostPosted: Fri Feb 13, 2009 7:32 am
Reply with quote

Hello Param,

Quote:
Hope I can get answers and contribute in this fourm.
We'd like that also. . . icon_smile.gif

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
View user's profile Send private message
Terry Heinze

JCL Moderator


Joined: 14 Jul 2008
Posts: 1249
Location: Richfield, MN, USA

PostPosted: Fri Feb 13, 2009 10:12 am
Reply with quote

Exterprise COBOL can handle an 01 level size of 128M minus 1 so you have plenty of wiggle room.
Back to top
View user's profile Send private message
Terry Heinze

JCL Moderator


Joined: 14 Jul 2008
Posts: 1249
Location: Richfield, MN, USA

PostPosted: Fri Feb 13, 2009 10:14 am
Reply with quote

Oops, I mean enterprise. I guess I should start using the Spellcheck. icon_redface.gif
Back to top
View user's profile Send private message
parampunit

New User


Joined: 04 Oct 2008
Posts: 6
Location: US

PostPosted: Fri Feb 13, 2009 10:21 am
Reply with quote

Thanks!!!
If there is no other alternative I will define the 2nd occurs to have the max value.
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 INCLUDE OMIT COND for Multiple values... DFSORT/ICETOOL 5
No new posts Replace Multiple Field values to Othe... DFSORT/ICETOOL 12
No new posts PuTTY - "User is not a surrogate... IBM Tools 5
No new posts Multiple table unload using INZUTILB DB2 2
No new posts Grouping by multiple headers DFSORT/ICETOOL 7
Search our Forums:

Back to Top