• Post Reply Bookmark Topic Watch Topic
  • New Topic

Using JNI to access COBOL prog from JAVA

 
V Hiwarkar
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

I need to write a JAVA programme which can access existing COBOL programme. I guess I will need to use JNI.
Please advise how?
Please advise if there are any useful links with examples.
And if I can get the mfcobol.jar freely available somewhere.

Thanks.
[ January 10, 2008: Message edited by: V Hiwarkar ]
 
Peter Chase
Ranch Hand
Posts: 1970
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
JNI is a C or C++ interface. Therefore, Java can only directly call C or C++.

If you want to call another language from Java, you need to write a "wrapper" in C or C++, which is called by Java and which calls the other language.

I would imagine it is possible to do that for COBOL, but I don't know, because I am lucky enough never to have had to use COBOL.
 
V Hiwarkar
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Peter Chase:
JNI is a C or C++ interface. Therefore, Java can only directly call C or C++.

If you want to call another language from Java, you need to write a "wrapper" in C or C++, which is called by Java and which calls the other language.

I would imagine it is possible to do that for COBOL, but I don't know, because I am lucky enough never to have had to use COBOL.


Thanks Peter for your reply.
I found examples where they could call COBOL programmes directly from JAVA but they are using mfcobol.jar. Do I need license to use mfcobol.jar
Thanks in advance.
 
Peter Chase
Ranch Hand
Posts: 1970
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by V Hiwarkar:
I found examples where they could call COBOL programmes directly from JAVA


I don't think you did. There is no direct COBOL calling interface to Java. This "mfcobol.jar" presumably achieves the illusion of a direct call by either: -

  • Including a "wrapper" native libary of its own.
  • Using RPC, CORBA, SOAP or similar. Those aren't direct calls - they go via a socket - although the client code can look like direct calls. Of course, indirect calling might suit your purposes; it would certainly be a more-common way to implement as hetrogenous a system as Java+COBOL.


  • Originally posted by V Hiwarkar:
    Do I need license to use mfcobol.jar

    I don't know for sure. "mfcobol.jar" is MicroFocus COBOL. MicroFocus is a company making commercial products, so I would guess you do need a license.
    [ January 10, 2008: Message edited by: Peter Chase ]
     
    V Hiwarkar
    Greenhorn
    Posts: 3
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Thanks Peter
     
    • Post Reply Bookmark Topic Watch Topic
    • New Topic
    Boost this thread!