COBOL programs and OO COBOL methods can use structures in their Linkage Sections and be passed data from a Java class, providing that the corresponding Java parameter is an object which implements the com.microfocus.cobol.lang.Datatype interface or com.microfocus.cobol.lang.CustomRecord, as described below:
package com.microfocus.cobol.lang;
public interface DataType
{
void synchronizeData();
byte[] getBytes();
}
and
package com.microfocus.cobol.lang;
public interface CustomRecord
{
public Object[] getParameters();
public void setParameters(Object[] parms);
}
Using com.microfocus.cobol.lang.Datatype/com.microfocus.cobol.lang.CustomRecord enables you to pass non-simple data into a COBOL program or method without needing to rearchitect the interface with numerous elementary data types.
An example of a class that implements the com.microfocus.cobol.lang.Datatype interface is com.microfocus.cobol.lang.Pointer, which is defined in mfcobol.jar. It has the following constructors:
/* Create a Pointer object from String initString*/ public Pointer(String initString); /* Create a Pointer object from StringBuffer initString */ public Pointer(StringBuffer initString); /* Create a pointer object containing 'capacity' bytes, */ /* space filling if initString has fewer characters */ /* than 'capacity' */ public Pointer(String initString, int capacity);