Using the JCA local ECI resource adapter with COMMAREA
To use COMMAREA with the JCA local ECI resource adapter, the input and output records must be instances of classes that implement javax.resource.cci.Record and javax.resource.cci.Streamable.
Consider updating applications to use JCICS Link as an alternative. See also Stabilization notices and discontinued functions.
6.3 beta The JCA ECI adapter in Liberty JVM server is removed as of CICS® TS 6.3.
6.16.2The JCA ECI adapter in Liberty JVM server is stabilized.
// Create the record for the input COMMAREA.
RecordImpl in = new RecordImpl();
// Create the input binary data.
byte[] commarea = "COMMAREA contents".getBytes();
// Set the data via an InputStream
ByteArrayInputStream inStream = new ByteArrayInputStream(commarea);
in.read(inStream);
// Create the record for the output COMMAREA.
RecordImpl out = new RecordImpl();
// Execute the program link.
interaction.execute(is, in, out);
// Get the data via an OutputStream.
ByteArrayOutputStream outStream = new ByteArrayOutputStream();
out.write(outStream);
commarea = outStream.toByteArray();
To retrieve a byte array from the output record, use the write method on the Streamable interface using a java.io.ByteArrayOutputStream object. The toByteArray() method on ByteArrayOutputStream provides the output data from the COMMAREA in the form of a byte array.
To provide more function for your specific JEE components, you can write implementations of the Record interface that allow you to set the contents of the record using the constructor. In this way you avoid use of the java.io.ByteArrayInputStream used in the example.
Rational® Application Developer provides the J2C tooling that allows you to build implementations of the Record interface from specific native language structures such as COBOL copybooks, with in-built support for data marshalling between Java and non-Java data types.