09 HEADER OCCURS 0 TO 5
DEPENDING ON HEADER-COUNT.
11 SOURCE-ITEM PIC 9(03).
The stub code will always try to read and write 5 SOURCE-ITEM(s) no matter what the value of HEADER-COUNT is set to.
This will cause failing of reading a line that has HEADER-COUNT=2 and only 2 SOURCE-ITEM entries as it will always try to read 5 item entries.
To fix, the velocity mappings need to be updated to support depends on.
Internally, the depends on is not defined in the FieldDef .. you would need to rely on getFieldDetails referencing a complex expression like ....getFieldDetail().getDependingOnDtls().getDependingOn().getField().getName()}
So FieldDef should be updated with a short cut to have .getDependingOn() available
Example ...getDependingOn().getField().getName()
The velocity scripts for POJO should be fixed to support at least 1D array that depends on a field for its size
The code gen does not generate code that supports resizing 1D arrays based on a "DEPENDS ON" defined in the copy book.
Example: 05 TOP. 07 TOP-GROUP. 09 TOP-GUN. 11 HEADER-COUNT PIC 9(1).
The stub code will always try to read and write 5 SOURCE-ITEM(s) no matter what the value of HEADER-COUNT is set to. This will cause failing of reading a line that has HEADER-COUNT=2 and only 2 SOURCE-ITEM entries as it will always try to read 5 item entries.
To fix, the velocity mappings need to be updated to support depends on. Internally, the depends on is not defined in the FieldDef .. you would need to rely on getFieldDetails referencing a complex expression like ....getFieldDetail().getDependingOnDtls().getDependingOn().getField().getName()} So FieldDef should be updated with a short cut to have .getDependingOn() available Example ...getDependingOn().getField().getName()
The velocity scripts for POJO should be fixed to support at least 1D array that depends on a field for its size