Reinhard-Prehofer / legstar

Automatically exported from code.google.com/p/legstar
0 stars 0 forks source link

Marshaling with 2 nested REDEFINES needing virtual buffers misplaces following fields #185

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. With this COBOL copybook

        01  COMMAREA.
            10 OUTER-REDEFINES-LONG PIC X(10).
            10 OUTER-REDEFINES-SHORT 
                  REDEFINES OUTER-REDEFINES-LONG.
               15 INNER-REDEFINES-LONG PIC X(5).
               15 INNER-REDEFINES-SHORT
                  REDEFINES INNER-REDEFINES-LONG PIC X(3).
            10 FOOTER PIC X.

2. After binding code is generated, this test code fails:

        Commarea c = new Commarea();
        OuterRedefinesShort ors = new OuterRedefinesShort();
        ors.setInnerRedefinesShort("ABC");
        c.setOuterRedefinesShort(ors);
        c.setFooter("Z");

        CommareaTransformers tf = new CommareaTransformers();
        assertEquals(11, tf.toHost(c).length);

Inner and outer redefines both have alternatives of different sizes.

There is a provision in the marshaler code to add offsets when the shorter 
alternative is chosen (since the fields coming after the REDEFINES must be 
placed at a fixed position). The character Z should therefore be at position 11.

The problem is this offset is currently stored in a class property and gets 
overriden when REDFINES are nested.

This issue is described here:  
https://groups.google.com/forum/#!topic/legstar-user/baj-5kp3R7Y

Original issue reported on code.google.com by fady.mou...@gmail.com on 19 Dec 2014 at 4:05

GoogleCodeExporter commented 9 years ago
This issue was closed by revision r2032.

Original comment by fady.mou...@gmail.com on 28 Dec 2014 at 10:25

GoogleCodeExporter commented 9 years ago

Original comment by fady.mou...@gmail.com on 28 Dec 2014 at 12:49

GoogleCodeExporter commented 9 years ago

Original comment by fady.mou...@gmail.com on 28 Dec 2014 at 12:51