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
 

 

3-D Table with nested DEPENDING ON Clause

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
VivekKhanna

New User


Joined: 09 Feb 2009
Posts: 57
Location: India

PostPosted: Sat Aug 08, 2015 11:18 pm    Post subject: 3-D Table with nested DEPENDING ON Clause
Reply with quote

Hi

I am facing problem with generating 3D Table with nested DEPENDING ON Clause. I need to generate the table with below requirement.

Code:
01 TEST1-TBL.
  05 TEST1-DATA1        PIC 99.
  05 TEST2-TBL OCCURS 1 TO 10 TIMES DEPENDING ON TST-CNT1 INDEXED BY TST2-INDX.
      10 TEST2-DATA1   PIC 99.
      10 TEST3-TBL OCCURS 1 TO 10 TIMES DEPENDING ON TST-CNT2 INDEXED BY TST3-INDX.
        15 TEST3-DATA1 PIC 99.
        15 TEST4-TBL OCCURS 1 TO 5 TIEMS DEPENDING ON TST-CNT3 INDEXED BY TST4-INDX.
          20 TEST4-DATA PIC 99.


I have tried to execute the code, during execution the first occurance gets executed perfectly fine. But from next occurance onwards as soon as MOVE [NEW-VAL] TO TST-CNT1, JUNK gets populated in the TST3-INDX.

Once the whole table with variable length gets populated, my requirement is to generate the XML without empty tags (variable length>.

Please suggest. Thanks in advance.
Back to top
View user's profile Send private message

Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 7914
Location: Bellevue, IA

PostPosted: Sat Aug 08, 2015 11:33 pm    Post subject:
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 this carefully as it describes almost exactly what you are doing. And the statement is made that if you want to change TST-CNT1 or TST-CNT2, the process is to copy the rest of the table to a different location (not subordinate to TEST1-TBL), change the occurs count, then move the data back into TEST1-TBL. In other words, you need to do a good bit of coding -- it might be easier for you to define the tables as fixed (no DEPENDING ON), then after they are completely ready to go then move them to TEST1-TBL so there is no manipulation of TST-CNT1, TST-CNT2, or TST-CNT3.
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7241

PostPosted: Sun Aug 09, 2015 3:51 am    Post subject: Reply to: 3-D Table with nested DEPENDING ON Clause
Reply with quote

Robert's idea is the best way to do it. Do all the manipulation you need in a fixed-length table of three dimensions. When everything is ready to generate the XML, only then set the ODO data-names and MOVE the group names (or loops with the individual names).

People often misunderstand what nested ODOs give them. Let's hope that doesn't include you.
Back to top
View user's profile Send private message
VivekKhanna

New User


Joined: 09 Feb 2009
Posts: 57
Location: India

PostPosted: Tue Aug 11, 2015 4:00 pm    Post subject:
Reply with quote

Thanks a lot Robert and Bill.

Robert,

The manual-link was really informative, with a small correction. The information is available in Enterprise COBOL Programming Guide . The content was really helpful.

Since we need to generate dynamic XML, the which should not have any empty tags. Thus we cannot use static variables. We were successfully able to generate dynamic XML.
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7241

PostPosted: Tue Aug 11, 2015 5:09 pm    Post subject: Reply to: 3-D Table with nested DEPENDING ON Clause
Reply with quote

It was not suggested that you use "static variables" for your XML generation. It was suggested you use them until all table-manipulation was complete in your program, and at that point copy the data to the variable-length tables. Then generate the XML.

That would save you all the "messing about" to keep things in step when you change the ODO values, which is just technical clutter, not part of your business requirement.

The future readers of your program would appreciate that.
Back to top
View user's profile Send private message
vangeti

New User


Joined: 26 Apr 2014
Posts: 2
Location: bangalore

PostPosted: Wed Aug 19, 2015 11:11 pm    Post subject: Reply to: 3-D Table with nested DEPENDING ON Clause
Reply with quote

Actually we do have a way to suppress the empty tags in cobol5.

XML GENERATE XML-OUT FROM STRUCTURE
COUNT IN XML-LEN
SUPPRESS EVERY NUMERIC WHEN ZERO
EVERY NONNUMERIC WHEN SPACES

now it will suppress the tag generation when numeric fields having data zero or nonnumeric values having spaces.
( we should initialize our structure before moving data into these. so that we can check for default values and suppress in xml generation).

We can give individual field names also in suppress stement
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 Need Rexx Program to Load in to DB2 T... Hareesh Verma CLIST & REXX 22 Tue Sep 20, 2016 2:59 pm
No new posts Command UNIQUE CONSTRAINT on any tabl... rohanthengal DB2 2 Thu Aug 18, 2016 3:48 pm
No new posts Updating online Db2 table kishpra DB2 3 Fri Aug 12, 2016 2:44 pm
No new posts Need help on SQL Dynamic WHERE Clause subratarec DB2 12 Sat Jul 16, 2016 3:11 pm
No new posts Getting soc4 on internal table in cobol abdulrafi COBOL Programming 13 Fri May 06, 2016 3:39 pm


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