Subject: | |
From: | |
Reply To: | |
Date: | Tue, 3 Apr 2001 19:40:47 +0200 |
Content-Type: | text/plain |
Parts/Attachments: |
|
|
Okay, I admit that I have zero experience with a C program using
the Java Native Interface (JNI) to initialize a virtual machine and
later call selected Java methods. I'm not sure if the JNI library
routines would be happy with a COBOL main program (there might be
a couple of differences in initialisation of stdin, stdout, stderr,
or Posix env vars, for example). I'm also a little worried that the
whole arrangement might have associated multithreading issues (as
the Java VM would "freeze" during times when the CPU is spent back
in the COBOL code)...
If I were looking for a way to have COBOL or any other native MPE
language (or CM program maybe) use Java "subroutines" or "services",
then I would probably consider trying to run the Java VM in a child
process (or totally separate job) and talk to it by named pipes or
something similar.
Just recently I was curious if Java could be used as a "gateway"
to give an MPE program "client access" to a remote SQL database like
Oracle or SQL Server. I tweaked a small JdbcProgram.java to read
SQL requests from one named pipe and return results to another one.
Similar to using MSG files, just that a multithreaded Java VM should
be able to handle multiple concurrent named pipes at the same time,
without any JNI coding needs. It did look promising, but I haven't
yet spent time to build a "full blown" example for more extensive
testing. (Willing to share my current source code, though).
Using HPCIOMMAND or CREATEPROCESS to run a Java program in a child
process and then talk to it through a pair of named pipes might be
somewhat easier to code in COBOL (or whatever language) and doing
the complete JNI excercise...
Lars.
|
|
|