Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Help on Multiple "Occurs Depending On"

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
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    Post subject: Help on Multiple "Occurs Depending On"
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

Site Director


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

PostPosted: Fri Feb 13, 2009 4:19 am    Post subject:
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    Post subject:
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

Site Director


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

PostPosted: Fri Feb 13, 2009 7:32 am    Post subject:
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: 1239
Location: Richfield, MN, USA

PostPosted: Fri Feb 13, 2009 10:12 am    Post subject:
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: 1239
Location: Richfield, MN, USA

PostPosted: Fri Feb 13, 2009 10:14 am    Post subject:
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    Post subject:
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    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 Amount field is getting corrupted whe... thesumitk SYNCSORT 5 Tue Oct 18, 2016 8:20 pm
No new posts hot to get details when "EXEC CI... Andi1982 CICS 11 Tue Sep 20, 2016 5:01 pm
No new posts Multi row fetch - "for read only... Nileshkul DB2 3 Sun Aug 14, 2016 12:52 am
No new posts "DFSRRC00 vs IKJEFT01" for ... arunsoods All Other Mainframe Topics 5 Fri Aug 12, 2016 9:54 pm
No new posts Converting multiple VB files to FB fi... Viswanath Reddy JCL & VSAM 6 Mon Aug 08, 2016 11:49 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us