Having problems with your account or logging in?
A lot of changes are happening in the community right now. Some may affect you. READ MORE HERE
canthonyparkinson Absent Member.
Absent Member.
848 views

Calling NATIVE COBOL from cobjvm

Jump to solution

 I am working my way through "Visual COBOL, a developer's guide to modern cobol".  I found an example on page 99 of "calling native code from managed COBOL".  Now our environment is LINUX and we use Java not .NET.  Does anyone have an example of this for JAVA and LINUX or is this even possible?

Tags (2)
0 Likes
1 Solution

Accepted Solutions
Highlighted
Micro Focus Expert
Micro Focus Expert

RE: Calling NATIVE COBOL from cobjvm

Jump to solution

The sample Yvon described is your best starting point for now. If you have specific questions after trying it out we'll be glad to help.

Paul Kelly, the author of Visual COBOL: A Developer's Guide to Modern COBOL, is working on a book for JVM COBOL.

(Incidentally: Neither "Java" nor "Linux" are acronyms, just proper nouns. There's no need to write them in block capitals.)

0 Likes
10 Replies
Yvon Abgrall Absent Member.
Absent Member.

RE: Calling NATIVE COBOL from cobjvm

Jump to solution
$COBDIR/demo/jvm_cobol/JVMNativeInterop is a delivered demonstration on how to call native COBOL from JVM COBOL

Regards

Yvon
0 Likes
Highlighted
Micro Focus Expert
Micro Focus Expert

RE: Calling NATIVE COBOL from cobjvm

Jump to solution

The sample Yvon described is your best starting point for now. If you have specific questions after trying it out we'll be glad to help.

Paul Kelly, the author of Visual COBOL: A Developer's Guide to Modern COBOL, is working on a book for JVM COBOL.

(Incidentally: Neither "Java" nor "Linux" are acronyms, just proper nouns. There's no need to write them in block capitals.)

0 Likes
canthonyparkinson Absent Member.
Absent Member.

RE: Calling NATIVE COBOL from cobjvm

Jump to solution
Thanks. I have got my test to run. I have one further question, I need to be able to invoke my mixed program with just the "java" command and not "cobjrun". It works with "cobjrun", but when I use "java" instead of "cobjrun" (the rest of the command is the same), I get this error.

com.microfocus.cobol.program.COBOLProgramLoadException: 173 Called program file not found in drive/directory [ap01a.so]
(107 Operation not implemented in this Run-Time System [Cannot load native COBOL programs in pure JVM COBOL runtime.])

Any ideas?
0 Likes
Yvon Abgrall Absent Member.
Absent Member.

RE: Calling NATIVE COBOL from cobjvm

Jump to solution
cobjrun has to be used.

Regards

Yvon

MF DOC:

Micro Focus Developer > Visual COBOL Development Hub 3.0 > Programming > Using COBOL and Java Together > Considerations

Java/COBOL Application Launcher
documentation.microfocus.com/.../GUID-7CA1C8A2-BFED-41A1-A7EA-599F01671A44.html
0 Likes
canthonyparkinson Absent Member.
Absent Member.

RE: Calling NATIVE COBOL from cobjvm

Jump to solution
That will not work for this situation, the "top" of the solution is a java class, and the whole thing is to run under TUXEDO as a service. TUXEDO will launch the JVM, I can set any environment variables and classpath as well as properties (java -D) but I cannot get it to call cobjrun.
0 Likes
Micro Focus Expert
Micro Focus Expert

RE: Calling NATIVE COBOL from cobjvm

Jump to solution
You might try creating a symbolic link for cobjrun named java, and place it on the PATH before the java binary would occur.

Blair McDonald

0 Likes
canthonyparkinson Absent Member.
Absent Member.

RE: Calling NATIVE COBOL from cobjvm

Jump to solution
TUXEDO does not actually use the "java" command, they have their own executable that instantiates the JVM (kind of like cobjrun does) but with more stuff going on.
0 Likes
Micro Focus Expert
Micro Focus Expert

RE: Calling NATIVE COBOL from cobjvm

Jump to solution
Can you compile your COBOL code as JVM COBOL rather than native?

Barring that, you'll probably have to run your native COBOL as a separate process and communicate with it using some form of IPC.
0 Likes
canthonyparkinson Absent Member.
Absent Member.

RE: Calling NATIVE COBOL from cobjvm

Jump to solution
I would like to get there eventually, but in the short term no. (SYBASE db precompile uses native Sybase SQL whereas OpenESQL uses a generic form of SQL and we have lots of embedded SQL). Separate Process would be quite a bit of work as well.
0 Likes
Yvon Abgrall Absent Member.
Absent Member.

RE: Calling NATIVE COBOL from cobjvm

Jump to solution
I have been goggling around "Java TUXEDO" and see no evidence of TUXEDO which would be using "their own executable that instantiates the JVM (kind of like cobjrun does) but with more stuff going on"...

Would you elaborate on this.
I found in TUXEDO DOC the PATH has to point to the bin directory of the installed JRE ... which would indicate TUXEDO/java use the java launcher ... !?

Also, taking this URL
docs.oracle.com/.../pgapi.html
Would you be trying to invoke JVM COBOL here?
...
rply = myAppCtxt.tpcall("SVC", rqStr, TPNOTIME|TPSIGRSTRT);
/* !? Invoke JVM COBOL here !? */
rtn = TuxAppContextUtil.tpappthrterm();
...

I don't have right now TUXEDO on line and never played so far with TUXEDO/Java ...


docs.oracle.com/.../javaservadmin.html
Oracle Tuxedo Java Server Administration

docs.oracle.com/.../pgint.html
Introduction to Oracle Tuxedo Java Programming

docs.oracle.com/.../index.html
Introduction to Oracle Tuxedo Java Programming

Regards

Yvon
0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.