What is IBM Record Generator for Java?

IBM® Record Generator for Java™ 3.0 is a stand-alone Java utility that generates Java helper classes to describe language-specific record structures. These helper classes can then be used in a Java application to marshal data to and from the byte-oriented record structures that are commonly used in z/OS applications, such as CICS COMMAREAs or VSAM files.

IBM Record Generator for Java 3.0 supersedes the alphaWorks version of the JZOS Record Generator V2.4.6, and provides new capabilities. For a summary of the new capabilities, see What's new?.

There are two implementations of IBM Record Generator for Java:
  • For COBOL copybooks, implemented by the RecordClassGenerator class in the supplied com.ibm.recordgen.cobol Java package.
  • For assembler-language DSECTs, implemented by the RecordClassGenerator class in the supplied com.ibm.recordgen.asm Java package.
Figure 1 shows the flow from COBOL and assembler input into ADATA files, which are used by IBM Record Generator for Java, along with the API package from the IBM JZOS Toolkit, to generate the Java helper classes.
Figure 1. How IBM Record Generator works

This flow chart starts with the COBOL copybook using the IBM Enterprise COBOL Compiler to create the ADATA file, and similarly with the Assembler DSECT using the High Level Assembler to create the ADATA file. The ADATA files flow into the IBM Record Generator for Java, where the RecordClassGenerator class which works with the JZOS Toolkit API to generates Java helper classes.

The RecordClassGenerator class reads as input the ADATA output from the IBM Enterprise COBOL for z/OS Compiler or the IBM High Level Assembler and generates Java source code to map a selected language-specific record structure.

The source that is generated by the RecordClassGenerator uses the com.ibm.jzos.fields API package from the IBM JZOS Toolkit, which contains data type converters for the elemental COBOL and assembler data types. An additional class, RecordXMLGenerator, can generate an XML representation of the imported language structures that can be modified in third-party tools, such as XSLT, then used as input to the RecordClassGenerator to generate the Java helper classes.

Note: The DatatypeFactory class used in the generated Java record detects if the IBM Data Access Accelerator (DAA) library is available at runtime and if so creates a DAA-enabled set of instances from the com.ibm.jzos.fields.daa package, which leverages DAA under the covers to optimize the conversion of any byte array numerical fields to and from numerical Java objects.

After it is generated, the source code of the Java helper classes can be compiled with the com.ibm.jzos.fields package to produce a Java class that has accessors for each individual field in the record. Each field in the record can be written to using the appropriate setter method and also read through a corresponding getter method. The entire byte array that represents the record can also be referenced by using the supplied getByteBuffer() method. This greatly simplifies the development of Java applications that need to interact with structured enterprise data.