Environment:
OS = Windows 7 Enterprise
cb2xml = version 1.01
Java = version 8 update 144
Steps to reproduce:
..\bin\cb2xml.bat test_01.cbl > test_01.xml
Expected result in XML:
GROUP display-length = 15, sum of display-length 10 and display-length 5
Actual result in XML:
GROUP display-length = 11, possibly sum of storage-length 6 and storage-length 5
See attached input and output files
Comment:
The element name "position" is ambiguous, because the storage-position and the display-position can be different.
Changing the name to "storage-position" would remove the ambiguity.
Also adding an element "display-position" would be a feature.
Input:
06 GROUP.
08 PACKED-NUMBER PIC 9(10) USAGE IS COMPUTATIONAL-3.
08 FILLER PIC X(5).
Output:
<copybook filename="test_01.cbl" dialect="Mainframe">
<item level="06" name="GROUP" position="1" storage-length="11" display-length="11">
<item level="08" name="PACKED-NUMBER" picture="9(10)" usage="computational-3" position="1" storage-length="6" display-length="10" numeric="true">
<item level="08" name="FILLER" picture="X(5)" position="7" storage-length="5" display-length="5">
</item>
</item></item></copybook>
The element name "position" is ambiguous, because the storage-position and the display-position can be different.
For storage-length there is 2 ways of looking at it
In Cobol Group-1 is in effect a Pic X field (x(10) for the above). For Group-Display-length = storage-length
Alternatively there is no point for storage-length=display-length.
I will look at
I there any reason why you want a Display position and Group-Display-Length
I don't need a separate element group-display-length, using display-length is OK if it sums correctly.
I suspected the position element was too set in stone to be changed.
The copybook I worked with when I saw the sum difference has about 500 fields in 8 levels, packed and signed fields to a storage-length > 1200.
Having group lengths summed and being able to see start positions also for display is helpful as we are moving to a different receiver architecture.
There is a new version
that changes Display-length / position.
The change in Group-Display-Length is for all generated Xml files.
The Display-Position tag is only displayed for the new (2017) format
i.e. something like the following
There will be a cb2xml-format="2017" on the copybook tag.
The Display Position is also available in the Java interface.