MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Help with Complex ODO

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming
View previous topic :: View next topic  
Author Message
Gary_Fsee
Beginner


Joined: 03 Jan 2005
Posts: 3
Topics: 2

PostPosted: Mon Jan 03, 2005 10:55 pm    Post subject: Help with Complex ODO Reply with quote

Hello
I have created a complex ODO structure as follows:
Code:

01 WS-FORMAT-DATA.
   05  WS-HEADER.
        10  A1      PIC X(05) VALUE 'AAAAA'.
        .
        .
        .
   05 Table-1   OCCURS 1 TO 5 TIMES
                                DEPENDING ON WS-COUNTER1
                                INDEXED BY IDX1.
        10 TABLE-ELEMENT-1   PIC X(60).
        10 TABLE-ELEMENT-2   PIC X(120).
        10 TABLE-ELEMENT-3   OCCURS 1 TO 50 TIMES
                                          DEPENDING ON WS-COUNTER2
                                          INDEXED BY IDX2
                                          PIC X(150).
         10  TABLE-ELEMENT-4  PIC X(75).
   05  WS-FOOTER               :?: PIC X(05).

01  WS-HOLD-DATA   PIC X(32767).

WS-COUNTER-1 and 2 are defined outside. I got no compilation errors. The objective of the program is to move contents of WS-FORMAT-DATA to WS-HOLD-DATA after formatting data in the 01 LEVEL.

Program logic is performed such that the value of ODO objects WS-COUNTER-2 changes with each increment of IDX1. I've also made sure that the both ODO objects are SET before a value is moved to the subordinate and non-subordinate items. I'm also moving the INDEX value IDX2 to an integer variable before WS-COUNTER-2 is changed and restoring the IDX2 value back after the change. I'm moving values to all the items in the 05 level with WS-FOOTER being the last receiving field.

My problem is that I don't see values in TABLE-ELEMENT-4 and WS-FOOTER from the 2nd occurrence of TABLE-1. All other elements have proper data in them.

What am I missing?

Thanks in advance for all your valuable response

Gary.
Back to top
View user's profile Send private message
Phantom
Data Mgmt Moderator
Data Mgmt Moderator


Joined: 07 Jan 2003
Posts: 1056
Topics: 91
Location: The Blue Planet

PostPosted: Tue Jan 04, 2005 12:37 am    Post subject: Reply with quote

Gary,

Are you incrementing WS-COUNTER-1 and WS-COUNTER-2 properly. Even though you update the IDX'n variables, the memory allocation for the tables are dependant on the values in WS-COUNTER-1 & WS-COUNTER-2. Make sure your code keeps the counter variables in sync. If possible pls post your piece of code that deals with the table manipulation.

Thanks,
Phantom
Back to top
View user's profile Send private message
Kathi
Beginner


Joined: 14 May 2003
Posts: 25
Topics: 0
Location: Mission Viejo, California

PostPosted: Tue Jan 11, 2005 11:08 pm    Post subject: Reply with quote

Variable Occurs within a Variable Occurs is not allowed.

This is the data structure you have created. Make one of them fixed and it will work.
Back to top
View user's profile Send private message
Gary_Fsee
Beginner


Joined: 03 Jan 2005
Posts: 3
Topics: 2

PostPosted: Wed Jan 12, 2005 11:53 pm    Post subject: Reply with quote

Not according to the COBOL Manual for Z/OS:

There are three basic forms of complex ODO permitted by the compiler:

1. A data item described by an OCCURS clause with the DEPENDING ON option is Followed by a nonsubordinate item. The nonsubordinate item is variably located.

2. A data item described by an OCCURS clause with the DEPENDING ON option is followed by a nonsubordinate data item described by an OCCURS clause with the DEPENDING ON option.

3. A data item described by an OCCURS clause with the DEPENDING ON option is nested within another data item described by an OCCURS clause with the DEPENDING ON option.

As I have said earlier I did not get any compile errors.

To answer KOLUSU's question I'm not incrementing the values of the WS-COUNTER-1 and WS-COUNTER-2. The value of WS-COUNTER-1 is determined first in the program logic and then the value of WS-COUNTER-2 is determined for each occurrence of WS-COUNTER-1. I guess it gets complicated here.

After much error and trial I decided to split-up the Group elements into TABLE-1, TABLE-2 , TABLE-3 ... each with OCCURS 0 TO 1 TIMES VERB and this seems to be working for me.

Thanks
Gary
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group