#82 Filler redefines problem

open
nobody
None
5
2010-05-31
2010-05-31
danieleacme
No

Hi Venkat,

I've found this problem :

on this picture
01 wdata pic 9(08) .
01 filler redefines wdata .
02 wdata-ss pic 9(02) .
02 wdata-aa pic 9(02) .
02 wdata-mm pic 9(02) .
02 wdata-gg pic 9(02) .
I've got this exception :

Invalid indexes :@(3030:8)
com.res.java.lib.exceptions.InvalidCobolFormatException:
at com.res.java.lib.CobolBytes.reportError(CobolBytes.java:1261)
at com.res.java.lib.CobolBytes.validate(CobolBytes.java:1232)
at com.res.java.lib.CobolBytes.setDisplayInt(CobolBytes.java:786)
at cobolprogramclasses.Testres.setWdata(Testres.java:75)
at cobolprogramclasses.Testres$1.run(Testres.java:402)
at com.res.java.lib.Program.doCobolGoto(Program.java:54)
at com.res.java.lib.Program.doCobolGotoStart(Program.java:78)
at cobolprogramclasses.Testres.execute(Testres.java:382)
at cobolprogramclasses.Testres.main(Testres.java:376)
Java Result: -1

I don't understand why (I have not looked at the code very well) but I made this workaround to fix that :

com.res.java.translation.symbol.SymbolUtil

private int getOffset(SymbolProperties props, int relativeToUnAdjustedOffset) {
if (relativeToUnAdjustedOffset >= 0 && props.isAParentInOccurs()) {
return props.getUnAdjustedOffset() - props.getOccursParents().get(props.getOccursParents().size() - 1).getUnAdjustedOffset();
}

//Orig
return (relativeToUnAdjustedOffset < 0) ? props.getOffset() : (props.getUnAdjustedOffset() - relativeToUnAdjustedOffset);

//Modif
return (relativeToUnAdjustedOffset <= 0) ? props.getOffset() : (props.getUnAdjustedOffset() - relativeToUnAdjustedOffset);
}

I've used 05-23-2010 version

I hope this is helpful you

Regards Daniele

Discussion