Skip to main content

[Migrated content. Thread originally posted on 30 May 2005]

Hi folks!

Is anyone out there doing anything with the version 7.0 beta and Java interoperability?

It's not obvious from the online documentation whether data can be passed BACK from calls to the CVM.

What we would like to be able to do is write a Java front-end that talks to server beans which in turn call Cobol modules to do the Vision file I/O.

Anyone know if this is possible?

[Migrated content. Thread originally posted on 30 May 2005]

Hi folks!

Is anyone out there doing anything with the version 7.0 beta and Java interoperability?

It's not obvious from the online documentation whether data can be passed BACK from calls to the CVM.

What we would like to be able to do is write a Java front-end that talks to server beans which in turn call Cobol modules to do the Vision file I/O.

Anyone know if this is possible?
It is possible to get information back from an AcuCOBOL-GT program to the calling Java program.

The example in Chapter 2.2.1.6 of the "A Guide to Interoperating with ACUCOBOL-GT" manual" - will be updated in the final 7.0.0 documentation to show how to do this. Here's a preview of the updated sample.

import com.acucorp.acucobolgt.*;

public static void main(String[] args) throws IOException {
try{
CVM cvm = CVM.GET_INSTANCE();
cvm.setErrorsOut("/tmp/errfile");
cvm.setConfigFile("c:/myproject/config");
cvm.initialize();

CALL_OPTIONS co = new CALL_OPTIONS();
co.setOption("debug", "1");

int intParam = 1;
Integer objInt = new Integer(intParam);

byte byteParam = 'a';
Byte objByte = new Byte(byteParam);

char charParam = 'b';
Character objChar = new Character(charParam);

Object params[] = {
objInt,
objByte,
objChar
};
cvm.callProgram("TestJavaToCobol", params, co);
cvm.cancelProgram("TestJavaToCobol");

objInt = (Integer)params[0];
objByte = (Byte)params[1];
objChar = (Character)params[2];

System.out.println("COBOL changed value to " objInt.intValue());
System.out.println("COBOL changed value to " objByte.byteValue();
System.out.println("COBOL changed value to " objChar.charValue());

cvm.shutdown();

} catch (Exception e){
e.printStackTrace();
}
}

[Migrated content. Thread originally posted on 30 May 2005]

Hi folks!

Is anyone out there doing anything with the version 7.0 beta and Java interoperability?

It's not obvious from the online documentation whether data can be passed BACK from calls to the CVM.

What we would like to be able to do is write a Java front-end that talks to server beans which in turn call Cobol modules to do the Vision file I/O.

Anyone know if this is possible?
Thanks for the reply. It's good to know that it IS possible.

Now I would love to hear from anyone who is actually doing this and can tell us about their experiences (good or bad).

Cheers.