206 Flexible Decision Automation for Your zEnterprise with Business Rules and Events
Unsupported types
Table 7-2 lists the unsupported types.
Table 7-2 Unsupported COBOL types
These types are not supported, because there are no suitable Java types to which to map.
We advise that you do not include these types in the import copybook. If the copybook
structure cannot be changed, for example, for compatibility with existing applications,
consider this work-around. In the copybook for importing, change the data item to a
corresponding ordinary alphanumeric or national type of the same length. Then, these data
items are mapped to Java strings in the generated XOM class.
There are also two unsupported Occurs Depending On (ODO) table situations:
򐂰 ODO table within a fixed-length table
򐂰 ODO table sharing the ODO object
Consider using a fixed-length table to work around these limitations.
You can use type converters to change the Java type to which a COBOL data item is mapped.
There are two built-in converters: String to boolean converter and String to Date converter.
You can also implement custom converters or set an XOM field to a custom-defined domain
7.2.3 Creating custom converters
In Chapter 3, “Getting started with business rules” on page 27, you learned how to use the
built-in type converters to map a COBOL data item to Java boolean or Date type. There are
cases when the built-in converter cannot meet your need. Then, you can write a custom
National NATIONAL PIC N(8) String
PIC 999V9
COBOL type COBOL usage and
compile options
PICTURE string Example XOM Java type
COBOL type COBOL usage and
compile options
PICTURE string Example
Alphabetic DISPLAY A PIC A(20).
AlphaNumericEdited DISPLAY A X 9 B 0 / PIC XBX.
NumericEdited DISPLAY B P V Z 9 0 / , . + - CR DB * cs PIC 9B9
ExternalFloat DISPLAY +9 -9 0 . V E 9. PIC +99V9E99.
NationalExternalFloat NATIONAL PIC +9.9E+99 PIC NBN
PIC $9.9
Chapter 7. Advanced topics for decision authoring 207
Consider this case. In a COBOL program, instead of using only T to indicate true, the program
also accepts t, Y, and y as true values. But the built-in boolean converter can accept only one
character as the true value. So, in this case, we write a custom converter.
custom converter is a normal Java class. The class must be annotated with the
TypeConverter annotation. In the Converter dialog, users can select those classes with only
the TypeConverter annotation, along with the built-in converters.
Then, we need implement an init method. This method is called by the run time to initialize the
converter with user-defined properties. There is also an optional TypeConverterProperties
annotation with which we can define the list of expected property keys. In this example, we
define two keys:
true-values A comma-separated list of characters that indicate true
false-value The default value that indicates false
In the init method, we retrieve the values of these properties. Then, we save the list of true
values to the trueValues field and set the falseValue field to the false-value character
(Example 7-1).
Example 7-1 Custom converter code (Part 1 of 2)
@TypeConverterProperties({ "true-values", "false-value" })
public class MyBooleanConverter {
private List<String> trueValues;
private String falseValue;
public void init(Map<String, String> props) {
String trueStr = props.get("true-values");
trueValues = Arrays.asList(trueStr.split(","));
falseValue = props.get("false-value");
Now, we can define two conversion methods:
public <TargetType> convertToTarget(<SourceType> value)
public <SourceType> convertToSource(<TargetType> value) {
The <SourceType> is the default Java type that directly mapped from COBOL data; the
<TargetType> is the type that we want to use in the generated XOM. The convertToTarget is
called during unmarshalling, and the convertToSource is called during marshalling.
In Example 7-2, if the value that comes from COBOL is within the trueValues, the result is
true. Any other values convert to false. During marshalling, if the Java value is true, the first of
the possible true values is used, which is T in this case. If the Boolean value is false, the false
value F is used.
Example 7-2 Custom converter code (Part 2 of 2)
public synchronized boolean convertToTarget(String value) {
return trueValues.contains(value);
public synchronized String convertToSource(boolean value) {
return value ? trueValues.get(0) : falseValue;

Get Flexible Decision Automation for Your zEnterprise with Business Rules and Events now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.