Variable length Two dimensional Array

This is a Mainframe COBOL forum - you can post your queries on Mainframe COBOL, VS COBOL II, COBOL/370 , Enterprise COBOL

Moderators: dbzTHEdinosauer, Moderator Group

Post Reply
mainframe60
Member
Posts: 2
Joined: Tue Apr 10, 2012 8:52 pm

Variable length Two dimensional Array

Post by mainframe60 » Tue Apr 10, 2012 9:04 pm

A two dimensional array with both being variable length. First array can occur from 1 to 100 times and the inner array from 1 to 10 times. The inner array is declared to a fixed length 10 rather than defining it as Occurs Depending ON clause. Module A creates the data that populates to this array (The layout contain additional fields to the array) and pass it on to Module B via linkage. Module B creates XML structure of this layout. Since the inner array is hard coded to 10 lots of unused bits are being transferred to the subsequent application thereby causing degradation of performance. My goal is to get the final XML structure with only valid values. Either
1. Only the valid values of the inner array needs to be created by module A and pass it to Module B or
2. Module A can pass the entire array layout with unused values and module B can create XML structure and then truncate to the valid values.
Please let me know as how can I implement this complex ODO.

DikDude
Moderator
Posts: 1001
Joined: Fri Jul 22, 2011 8:39 am
Location: usa

Post by DikDude » Tue Apr 10, 2012 11:26 pm

From the Enterprise COBOL Language Reference:
The object of the OCCURS DEPENDING ON clause cannot be variably located; the object cannot follow an item that contains an OCCURS DEPENDING ON clause.
Looks like you'll need another approach.

I suspect the ODO will not add anything really useful to the code - and it will allocate the max bytes anyway, so it may be best to remove this. Build only what is needed for the XML structure(s) in the fixed nested arrays.
Have a good one

mainframe60
Member
Posts: 2
Joined: Tue Apr 10, 2012 8:52 pm

Post by mainframe60 » Wed Apr 11, 2012 12:26 am

Thanks for the reply. Currently the inner array is declared as fixed array only and passing the unused bytes on to the XML structure. But would like to know if I have anyother approach to avoid this.

User avatar
dbzTHEdinosauer
Moderator
Posts: 981
Joined: Mon Oct 02, 2006 8:31 pm

Post by dbzTHEdinosauer » Wed Apr 11, 2012 1:20 am

you may want to look into the verification side of the xml generate,
possibly you can establish a rule, where binary zeroes are not allowed,
yet give no error?
or an error that you accept as OK.

back to the technical side:
maybe you have to add a counter in the first dimension (for the second)
and break-up you xml generate into 3 parts:
1. for everything prior to the 2 demensional table
2. a COBOL loop whereby
each item in the first demension is passed to the XML Generate as a group item
with the appropriate 2d demsion items as a table subordinate to the group ittem
(which was the item from the first demeinsion
and the 2nd demension counter (now part of the group item
will compile as a simple ODO and the XML Generate will function as demo'd)
3. for everything after the table.
Dick Brenholtz
JCL, SQL and code in programs have an irritating habit of doing what you say,
not what you meant.

Post Reply

FREE TUTORIALS

Tutorials
Free tutorials from mainframegurukul
  • JCL Tutorial
    Covers all important JCL concepts.
  • Cobol Tutorial
    This tutorials covers all Cobol Topics from STRING to COMP-3.
  • DB2 Tutorial
    DB2 Tutorial focuses on DB2 COBOL Programming.
  • SORT Tutorial
    This Tutorial covers all important aspects of DFSORT with examples
  • CICS Tutorial
    This CICS tutorial covers CICS concepts and CICS Basics, CICS COBOL Programming.
Interview
Mainframe Interview questions



Other References
Mainframe Tools and others