Chapter 7. Advanced topics for decision authoring 211
7.3.1 Mapping Java data structures to COBOL
This section explains mapping Java data structures to COBOL.
Aggregation data structure
When mapping Java BOMs to COBOL, only BOM classes with aggregation relationships are
supported. If there are object references, a simple hierarchical data structure is supported.
Complex object graphs are not supported. For example, the Insurance class has a field called
Vehicle of type Vehicle. The vehicle information is part of the insurance data, and it is a simple
hierarchical data structure. This example is supported.
But, if the Vehicle class references Insurance either directly or indirectly through other
classes, the data structure is not hierarchical. It contains loops. In this case, the BOM to
COBOL mapping is not supported. In addition, class inheritance is not supported. The BOM
must not include the following usage:
Inheritance
Loop reference, including self-reference
Static attribute
Also, ensure that the BOM classes follow Java Bean naming guidelines, such as well-formed
getters and setters; otherwise, generated marshaller classes contain incorrect code.
General mapping rule
A BOM class is mapped to a COBOL group. Fields of the basic Java type are mapped to child
elementary data items. And, fields of the class type are mapped as subgroups (Example 7-6).
Example 7-6 A BOM with two classes
package xom;
public class Request {
public xom.Driver primaryDriver;
public xom.Driver secodaryDriver;
}
public class Driver {
public short age;
public string name;
}
When this BOM is mapped to a COBOL copybook, the primaryDriver and secodaryDriver
fields are generated as two groups with the same structure (Example 7-7).
Example 7-7 Copybook with two similar groups
01 request.
02 primaryDriver.
03 age pic S9(5).
03 name pic X(20) value SPACE.
02 secodaryDriver.
03 age pic S9(5).
03 name pic X(20) value SPACE.
An array is mapped to a table, and a collection is mapped to a size data item and a table
(Example 7-8 on page 212).