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

Multiple OCCURS depending on in same group


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

New User


Joined: 19 Nov 2007
Posts: 8
Location: cheanni

PostPosted: Fri Aug 21, 2015 4:23 pm
Reply with quote

Hi All,

I am getting a problem while using multiple OCCURS depending on in same 01 group level.

Code:
05 INDV-TABLE OCCURS 1000 TIMES
         DEPENDING ON INDV-TABLE-CNT
         INDEXED BY INDV-INDX.
   10 INDV-VAR-1     PIC X(10).
   10 INDV-VAR-2     PIC X(10).
   10 INDV-VAR-3     PIC X(10).


05 ORG-TABLE OCCURS 500 TIMES
         DEPENDING ON ORG-TABLE-CNT
         INDEXED BY ORG-INDX.
   10 ORG-VAR-1     PIC X(10).
   10 ORG-VAR-2     PIC X(10).
   10 ORG-VAR-3     PIC X(10).




Code:
MOVE 5     TO   INDV-TABLE-CNT.
MOVE 1     TO   ORG-TABLE-CNT.
:
:
:
:
SET ORG-INDX  TO 1
MOVE SPACES TO ORG-VAR-2(ORG-INDX).

I am getting SOC7 in the above move statement.
My problem is for the first Table which has OCCURS depending ON I don't have any problem.
But from the second table I am not able to access any variables and I am getting SOC7 error.

If I remove the "DEPENDING ON" from first array then the second aray is working fine as expected.
I feel that some INDEX level problem.

Can you please help me?

Code'd
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Fri Aug 21, 2015 4:29 pm
Reply with quote

Please use the Code tags to preserve spacing.

Please answer questions on your other topic. Show the definitions of your ODO items. Are you certain that the items are set to some value before you use them? What do you have for compiler option NUMPROC? Are you using compiler option SSRANGE?
Back to top
View user's profile Send private message
muralirajansm

New User


Joined: 19 Nov 2007
Posts: 8
Location: cheanni

PostPosted: Fri Aug 21, 2015 4:38 pm
Reply with quote

Hi Bill,

Please ignore my previous tpoic("OCCURS DEPENDING ON"). That was my mistake.

I am using the below compiler option only
//LINKSVC EXEC PGM=IEWL,REGION=0K,
// PARM='LIST,XREF'

I need help on this topic only. Kindly help me.
Back to top
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 2455
Location: Hampshire, UK

PostPosted: Fri Aug 21, 2015 4:43 pm
Reply with quote

You were asked to use the code tags. Please search the forum to find out how to do this. code tags should be used when presenting code, control cards, jcl, data and anything else that needs to be in a fixed font with spacing preserved.

IEWL is the linker/binder and not the compiler so go and look at the previous setp - or your compile listing where the options are shown.
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Fri Aug 21, 2015 4:51 pm
Reply with quote

You just need to find those two options on the compile listing (first page).

You haven't attempted yet to show how yours "counts" are defined, and where.

Check for other questions.
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Fri Aug 21, 2015 5:56 pm
Reply with quote

Have you read the Enterprise COBOL Programming Guide Appendix 1.2.2.2 titled Preventing overlay when adding elements to a variable table ? If not, you need to read it carefully. COBOL can handle having multiple OCCURS DEPENDING ON under an 01 level, but the behavior is not always what the programmer expects. And compiler options can certainly impact the results!
Back to top
View user's profile Send private message
Rohit Umarjikar

Global Moderator


Joined: 21 Sep 2010
Posts: 3051
Location: NYC,USA

PostPosted: Fri Aug 21, 2015 8:35 pm
Reply with quote

You should correct your declaration.

www-01.ibm.com/support/knowledgecenter/?lang=en#!/SS6SG3_4.2.0/com.ibm.entcobol.doc_4.2/PGandLR/tasks/tptbl27.htm
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 Multiple table unload using INZUTILB DB2 2
No new posts Grouping by multiple headers DFSORT/ICETOOL 7
No new posts How to append a PS file into multiple... JCL & VSAM 3
Search our Forums:

Back to Top