To read a data field <XXX>
it is necessary to call the method get<XXX>()
. The return value supplied by this method is an object of the same type as the COBOL data field. Each object possesses methods adapted to the type that are used to extract the data:
for |
|
for |
|
When COBOL is used, it is possible that a numerical data field (PIC 9(n)
) is initialized with a non-numerical value, e.g. blanks or 'X00'
. To avoid the output of any NumberFormatException
when accessing this type of "undefined" field, the following methods are available to check the content:
for |
|
The default value for "undefined" can be specified when the Java class is created. (see Generating Java classes on Unix, Linux or Windows systems ).
If a data field is only initialized with the default value for "undefined" (isUndefined()
returns true
) and if this default value is not numerical, then the value 0 is returned when the field is read.