Using the generated Java helper class in an application
The Java class created by the RecordClassGenerator class can be used as part of an existing Java application to construct or parse a byte array passed to or from an assembler application.
- Create a new instance of the generated class then use the accessor methods to set the fields in the class and obtain a byte array that represents the fields you have set, ready to be used by the assembler program.
- Create an instance of the generated class based on an existing byte array that was passed to the Java program from the assembler program. The accessor methods can then be used to obtain the values from fields in the byte array.
Constructing a new record
MyRecord rec = new MyRecord();
String claimnum = "0000000000123456789";
rec.setClaimNumber(claimnum);
byte[] record = rec.getByteBuffer();
Creating a record from an existing byte array
byte[] record;
MyRecord rec = new MyRecord(record);
String claimnum = rec.getClaimNumber();
Usage of the Data Access Accelerator Library
You can use the methods in the IBM® Data Access Accelerator (DAA) library to improve performance when your Java™ code manipulates native data. For more information, see Native data operations in the IBM SDK documentation.
The AssemblerDatatypeFactory in a generated record will detect if DAA is available at run time and will create a DAA-enabled set of instances from the com.ibm.jzos.fields.daa package, which will leverage DAA under the covers to optimize the conversion of numerical data within a byte array to and from numerical Java objects. This support is dynamically enabled if the underlying DAA support is available in the IBM SDK at runtime. DAA can be disabled by setting the system property com.ibm.jzos.fields.use-daa explicitly to false.