Retrieving the contents of a field

Retrieve the contents of a Record object by having your Java™ program either get one field at a time or get all the fields at once.

Use the getField() method to retrieve a single field by name or by index. Use the getFields() method to retrieve all of the fields as an Object[].

The Java program must cast the Object (or element of the Object[]) returned to the appropriate Java object for the retrieved field. The following table shows the appropriate Java object to cast based on the field type.

Field Type (DDS) Field Type (FieldDescription) Java Object
BINARY (B), length <= 4 BinaryFieldDescription Short
BINARY (B), length >= 5 BinaryFieldDescription Integer
CHARACTER (A) CharacterFieldDescription String
DBCS Either (E) DBCSEitherFieldDescription String
DBCS Graphic (G) DBCSGraphicFieldDescription String
DBCS Only (J) DBCSOnlyFieldDescription String
DBCS Open (O) DBCSOpenFieldDescription String
DATE (L) DateFieldDescription String
FLOAT (F), single precision FloatFieldDescription Float
FLOAT (F), double precision FloatFieldDescription Double
HEXADECIMAL (H) HexFieldDescription byte[]
PACKED DECIMAL (P) PackedDecimalFieldDescription BigDecimal
TIME (T) TimeDecimalFieldDescription String
TIMESTAMP (Z) TimestampDecimalFieldDescription String
ZONED DECIMAL (P) ZonedDecimalFieldDescription BigDecimal