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: 1249
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: 1249
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 Unable to create multiple files using... mbattu COBOL Programming 3 Fri May 05, 2017 5:35 pm
No new posts READ A PACKED "NEGATIVE" FI... jdesouza CA Products 3 Tue May 02, 2017 11:43 pm
This topic is locked: you cannot edit posts or make replies. SDSF multiple spool datasets extracte... PJAlarcon CLIST & REXX 1 Fri Apr 21, 2017 10:50 pm
No new posts RC 20 for Address ISPEXEC "ISRED... pkmurali CLIST & REXX 3 Sun Apr 16, 2017 11:30 pm
No new posts Validating file with multiple header/... mohitsaini DFSORT/ICETOOL 6 Thu Apr 13, 2017 1:53 am


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