# How to Call Java from Natural and Vice versa without using any middleware / integration layer

**URL:** <https://techcommunity.softwareag.com/t/how-to-call-java-from-natural-and-vice-versa-without-using-any-middleware-integration-layer/296867>\
**Category:** Forum\
**Tags:** Adabas-Natural, Adabas, Natural, Adabas-on-Mainframes, Mainframe-Integration, EntireX, Natural-on-Mainframes\
**Created:** [June 11, 2024, 7:21am UTC](https://techcommunity.softwareag.com/t/how-to-call-java-from-natural-and-vice-versa-without-using-any-middleware-integration-layer/296867 "2024-06-11T07:21:40Z")\
**Posts on this page:** 19\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mukunthan\_Sundararajan2](https://avatars.discourse-cdn.com/v4/letter/m/dbc845/32.png) [@Mukunthan\_Sundararajan2](https://techcommunity.softwareag.com/u/Mukunthan_Sundararajan2)\
**Post date:** [June 11, 2024, 7:21am UTC](https://techcommunity.softwareag.com/t/how-to-call-java-from-natural-and-vice-versa-without-using-any-middleware-integration-layer/296867/1 "2024-06-11T07:21:40Z")

</div>

#Natural Calling #java # JAVA CALLING #Natural

I am creating new Java functionality which will run on Mainframe ZOS. (Now we can run Java on IBM Mainframe.) we are a big Natural Adabas shop - just wondering when my natural and Java applications will run on the mainframe - do I need to have any middleware to communicate between Java and natural and vice versa? when I checked the documentation it says from natural to call Java we can use JNI - but we need to create some “C” wrapper to access Java. Java to Natural - Via Entire X. These are all very old posts.

Is there any update in the Natural / Adabas products where we can access Java which is running on the mainframe?

Can someone help with the steps to implement - Call Java directly from Natural and vice versa without any middle/ware and any C wrapper.

Thanks in advance - hoping will get a positive response

---

<div class="post-metadata">

**Author:** ![Eugene.Miklovich](https://avatars.discourse-cdn.com/v4/letter/e/ce73a5/32.png) [@Eugene.Miklovich](https://techcommunity.softwareag.com/u/Eugene.Miklovich)\
**Post date:** [June 11, 2024, 12:24pm UTC](https://techcommunity.softwareag.com/t/how-to-call-java-from-natural-and-vice-versa-without-using-any-middleware-integration-layer/296867/2 "2024-06-11T12:24:08Z")

</div>

With EntireX SDK you can generate a “Java Class I/O interface (that’s the new term to replace term Wrapper)”. Use the SDK to extract the IDL from a NATURAL subprogram first then you can generate the IO interface. You will need to run NATURAL RPC server to expose the NATURAL subprogram as a service.

Eugene (Gene) Miklovich

ADABAS/NATURAL Systems Support and DBA

Cell: 916-202-7047

Normal Hours: 8am-4pm E.T.

Please call or text if assistance needed outside these hours.

---

<div class="post-metadata">

**Author:** ![Mukunthan\_Sundararajan2](https://avatars.discourse-cdn.com/v4/letter/m/dbc845/32.png) [@Mukunthan\_Sundararajan2](https://techcommunity.softwareag.com/u/Mukunthan_Sundararajan2)\
**Post date:** [June 11, 2024, 2:33pm UTC](https://techcommunity.softwareag.com/t/how-to-call-java-from-natural-and-vice-versa-without-using-any-middleware-integration-layer/296867/3 "2024-06-11T14:33:47Z")

</div>

Hello Eugene,

Thank you for your response; it is greatly appreciated.

Given that both the Natural application and the new Java application are running on the mainframe, do I still need EntireX? I am exploring a solution similar to JNI, which would establish bidirectional communication between Natural and Java. Could you please advise if this solution makes sense?

I was under the impression that EntireX is required only for interfacing external non-mainframe systems with Natural on the mainframe.

Mukunthan Sundararajan

---

<div class="post-metadata">

**Author:** ![Eugene.Miklovich](https://avatars.discourse-cdn.com/v4/letter/e/ce73a5/32.png) [@Eugene.Miklovich](https://techcommunity.softwareag.com/u/Eugene.Miklovich)\
**Post date:** [June 11, 2024, 4:42pm UTC](https://techcommunity.softwareag.com/t/how-to-call-java-from-natural-and-vice-versa-without-using-any-middleware-integration-layer/296867/4 "2024-06-11T16:42:09Z")

</div>

While it is certainly possible I am not aware of any direct calling.

Both JAVA and NATURAL like to be in control.

In reality neither one has executable binary modules. They both use P-CODE.

The P-CODE is interpreted by a supervisor (in JAVA it is a JVM) that is in control.

So the JAVA objects runs under a JVM and the NATURAL Object under a NATURAL Session (let’s call it a NVM).

So EntireX is needed to communicate. Even on mainframe.

I have used it to communicate between NATURAL and COBOL.

Eugene (Gene) Miklovich

ADABAS/NATURAL Systems Support and DBA

Cell: 916-202-7047

Normal Hours: 8am-4pm E.T.

Please call or text if assistance needed outside these hours.

---

<div class="post-metadata">

**Author:** ![Douglas\_Kelly](https://sea1.discourse-cdn.com/techcommunity/user_avatar/techcommunity.softwareag.com/douglas_kelly/32/102_2.png) [@Douglas\_Kelly](https://techcommunity.softwareag.com/u/Douglas_Kelly)\
**Post date:** [June 11, 2024, 4:55pm UTC](https://techcommunity.softwareag.com/t/how-to-call-java-from-natural-and-vice-versa-without-using-any-middleware-integration-layer/296867/5 "2024-06-11T16:55:55Z")

</div>

This appears to be nearly the same topic as raised by “ak\_kannan Kannan\_Alagarsamy” - perhaps you could review that discussion.

As there is no direct “call” function between Java and Natural (as Eugene has explained), a middleware of some sort is needed, whether it is passing sequential files back and forth or using a messaging tool like EntireX.

EntireX can either use web services or Java / Natural Wrappers to call to/from Java and Natural. Wrappers allow each tool to use it’s own native objects to communicate with the other platform. Web services have a bit more overhead, but allow more portability - Java calling Natural RPC services exposed as EntireX web services does not need an EntireX runtime, but the Wrappers approach will need an EntireX runtime available.

---

<div class="post-metadata">

**Author:** ![Mukunthan\_Sundararajan2](https://avatars.discourse-cdn.com/v4/letter/m/dbc845/32.png) [@Mukunthan\_Sundararajan2](https://techcommunity.softwareag.com/u/Mukunthan_Sundararajan2)\
**Post date:** [June 12, 2024, 5:36pm UTC](https://techcommunity.softwareag.com/t/how-to-call-java-from-natural-and-vice-versa-without-using-any-middleware-integration-layer/296867/6 "2024-06-12T17:36:44Z")

</div>

Thank you, Douglas - I am still trying to make it work using my beating around-bush solution 🙂 I am not sure whether I will win or lose. This is what I am trying

Natural Program Calling COBOL - This works fine.  
COBOL Program Calling Java on z/OS - This also works fine.  
COBOL Calling Natural - No issues here.  
Java Calling COBOL - This works without any problems.  
The problem arises when I try to combine these scenarios:

Natural calls COBOL, and COBOL calls Java: This sequence results in a NAT9974 error (Natural termination forced by abend 4088 RC=03EC), indicating memory exhaustion. Based on my research, this seems related to LE (Language Environment) and RENT-REENTER settings.  
Details:

I’m not using any middleware; instead, I use JNI for COBOL to call Java, which works as expected.  
The issue seems to be that Natural does not properly wait for COBOL to complete the Java call and return, leading to the error.  
I’ve tried adjusting memory regions (0M, 8M, 128M) with no success. I’m considering an alternative approach where JNI calls C, and Natural uses C to invoke Java.

I don’t know who will signal natural that Cobol is calling Java and give some data from Java to natural.

If this solution works - will keep you all posted. if you see any flaw in the solution please advice me

---

<div class="post-metadata">

**Author:** ![Wolfgang\_Rohlfs2](https://avatars.discourse-cdn.com/v4/letter/w/53a042/32.png) [@Wolfgang\_Rohlfs2](https://techcommunity.softwareag.com/u/Wolfgang_Rohlfs2)\
**Post date:** [June 13, 2024, 7:12am UTC](https://techcommunity.softwareag.com/t/how-to-call-java-from-natural-and-vice-versa-without-using-any-middleware-integration-layer/296867/7 "2024-06-13T07:12:05Z")

</div>

Hello,

Mukuthan, this reads like you are creating your own middleware using COBOL.

How will you call it?

Greetings

---

<div class="post-metadata">

**Author:** ![Mukunthan\_Sundararajan2](https://avatars.discourse-cdn.com/v4/letter/m/dbc845/32.png) [@Mukunthan\_Sundararajan2](https://techcommunity.softwareag.com/u/Mukunthan_Sundararajan2)\
**Post date:** [June 13, 2024, 6:16pm UTC](https://techcommunity.softwareag.com/t/how-to-call-java-from-natural-and-vice-versa-without-using-any-middleware-integration-layer/296867/8 "2024-06-13T18:16:11Z")

</div>

Hello Wolfgang Rohlfs,

Thank you for your reply.

We are not trying to create our middleware using COBOL. Our POC aims to call a Java method from Natural via COBOL without using messaging or middleware.

Here’s what we’re attempting:

1. We can run Java on z/OS, and COBOL can call Java using JNI on z/OS.
2. We want to invoke a Natural program that calls a COBOL program, which in turn calls a Java program and returns a result to COBOL and then back to Natural.
3. Individually, the following work well:

- Natural to COBOL: Passing parameters from Natural to COBOL works fine.
- COBOL to Java: Passing parameters from COBOL to Java works fine. in this, able to process and return value to COBOL.

However, when executing the complete thread, it fails:

1. Initially, we encountered a Getmain error due to the Region parameter in the job. We set it to 0, resolving this issue.
2. We confirmed that Natural can pass parameters to COBOL and COBOL can read these values, (its proven solution).
3. When COBOL tries to invoke the Java method by passing the parameter received from Natural via the linkage section, it fails, stating it cannot find the Java method / unable to invoke the Java method.

I am unsure why the end-to-end process fails, as individual calls (Natural to COBOL and COBOL to Java) work. Do we need additional parameters at the Natural system level to facilitate this hybrid call? I am testing this in Batch mode.

Do you have any advice on whether this approach will work? I want to keep communication simple between the languages without introducing middleware or messaging components. If my COBOL program can successfully locate and invoke the Java method, the process should complete with the value returned to COBOL and then to Natural.

Do you recommend this solution, and is it worth pursuing this POC?

Thank you for your guidance.

Best regards,

---

<div class="post-metadata">

**Author:** ![Mukunthan\_Sundararajan2](https://avatars.discourse-cdn.com/v4/letter/m/dbc845/32.png) [@Mukunthan\_Sundararajan2](https://techcommunity.softwareag.com/u/Mukunthan_Sundararajan2)\
**Post date:** [June 14, 2024, 2:57am UTC](https://techcommunity.softwareag.com/t/how-to-call-java-from-natural-and-vice-versa-without-using-any-middleware-integration-layer/296867/9 "2024-06-14T02:57:05Z")

</div>

Software AG does not have any implementation in NAtural to invoke Java Method directly - when Java runs on Mainframe zOS? like what IBM did - using JNI to invoke the Java method from COBOL. or I don’t know whether I am missing something. When all are running on the mainframe - why do we need Entirex or Messaging to invoke and pass the parameter between the languages?

If I am correct, I think we can use JNI with C to communicate between Natural and Java without any middleware.

please let me know if there is any alternative solution when all are on the mainframe. kind of Natural Parms setting or some tweaking is required etc.

---

<div class="post-metadata">

**Author:** ![Neil\_Beesley9](https://sea1.discourse-cdn.com/techcommunity/user_avatar/techcommunity.softwareag.com/neil_beesley9/32/37232_2.png) [@Neil\_Beesley9](https://techcommunity.softwareag.com/u/Neil_Beesley9)\
**Post date:** [November 1, 2024, 2:49am UTC](https://techcommunity.softwareag.com/t/how-to-call-java-from-natural-and-vice-versa-without-using-any-middleware-integration-layer/296867/10 "2024-11-01T02:49:32Z")

</div>

Douglas,  
Purely by coincidence I have been working on calling Java from ASM/COBOL/higher level languages (e.g. NATURAL) as part of an open mainframe project. I had to provide the following key functionality (not an exhaustive list) to call Java from ASM/COBOL/etc within the same address space:

1. Simple calling API to send/receive data between ASM/COBOL/etc. and Java
2. Being able to dynamically load Java classes and call the method specified in the API
3. Start the JVM once and only once within the job step of the JCL
4. Capability to work with multi-threaded ASM/COBOL/etc. applications efficiently  
Since it’s an ongoing open mainframe project it may be of some use to someone.  
Neil.

---

<div class="post-metadata">

**Author:** ![Douglas\_Kelly](https://sea1.discourse-cdn.com/techcommunity/user_avatar/techcommunity.softwareag.com/douglas_kelly/32/102_2.png) [@Douglas\_Kelly](https://techcommunity.softwareag.com/u/Douglas_Kelly)\
**Post date:** [November 1, 2024, 4:21pm UTC](https://techcommunity.softwareag.com/t/how-to-call-java-from-natural-and-vice-versa-without-using-any-middleware-integration-layer/296867/11 "2024-11-01T16:21:12Z")

</div>

Interesting! Which product starts the address space? Both Natural and Java like to have their runtime environment, which makes it difficult to keep both around and avoid the startup cost of the runtime on each access of the other’s processes.

---

<div class="post-metadata">

**Author:** ![jsranso](https://avatars.discourse-cdn.com/v4/letter/j/9f8e36/32.png) [@jsranso](https://techcommunity.softwareag.com/u/jsranso)\
**Post date:** [November 1, 2024, 4:52pm UTC](https://techcommunity.softwareag.com/t/how-to-call-java-from-natural-and-vice-versa-without-using-any-middleware-integration-layer/296867/12 "2024-11-01T16:52:48Z")

</div>

Hi Douglas - can you share the coding of the Assembler macro you used to call Java?

---

<div class="post-metadata">

**Author:** ![Neil\_Beesley9](https://sea1.discourse-cdn.com/techcommunity/user_avatar/techcommunity.softwareag.com/neil_beesley9/32/37232_2.png) [@Neil\_Beesley9](https://techcommunity.softwareag.com/u/Neil_Beesley9)\
**Post date:** [November 1, 2024, 5:59pm UTC](https://techcommunity.softwareag.com/t/how-to-call-java-from-natural-and-vice-versa-without-using-any-middleware-integration-layer/296867/13 "2024-11-01T17:59:43Z")

</div>

Natural and Java both live in the same address space (64 bit so plenty of space). The JVM (JVMPRC16) starts a general purpose Java utility. The general purpose Java utility starts the actual “main” program – which reads/writes all its DD statements as it normally would. Communication then occurs via an API from the “main” ASM/3GL/higher level language (e.g. Natural) to dynamically call the Java class/method specified by the API calls.

---

<div class="post-metadata">

**Author:** ![Neil\_Beesley9](https://sea1.discourse-cdn.com/techcommunity/user_avatar/techcommunity.softwareag.com/neil_beesley9/32/37232_2.png) [@Neil\_Beesley9](https://techcommunity.softwareag.com/u/Neil_Beesley9)\
**Post date:** [November 1, 2024, 6:11pm UTC](https://techcommunity.softwareag.com/t/how-to-call-java-from-natural-and-vice-versa-without-using-any-middleware-integration-layer/296867/14 "2024-11-01T18:11:59Z")

</div>

I’m in the process of tidying up the Github code so it’s more easy to install or adapt.

---

<div class="post-metadata">

**Author:** ![Neil\_Beesley9](https://sea1.discourse-cdn.com/techcommunity/user_avatar/techcommunity.softwareag.com/neil_beesley9/32/37232_2.png) [@Neil\_Beesley9](https://techcommunity.softwareag.com/u/Neil_Beesley9)\
**Post date:** [December 10, 2024, 2:54am UTC](https://techcommunity.softwareag.com/t/how-to-call-java-from-natural-and-vice-versa-without-using-any-middleware-integration-layer/296867/15 "2024-12-10T02:54:25Z")

</div>

#### Here is the public GIT repository containing the open source code for ASMcallingJAVA. This url points you to the README.MD:

`https://github.com/genevaers/Research-And-Development/blob/master/POC-iterations/ASMcallingJAVA/README.md`

---

<div class="post-metadata">

**Author:** ![Hritik\_Roshan](https://sea1.discourse-cdn.com/techcommunity/user_avatar/techcommunity.softwareag.com/hritik_roshan/32/39209_2.png) [@Hritik\_Roshan](https://techcommunity.softwareag.com/u/Hritik_Roshan)\
**Post date:** [October 21, 2025, 10:14am UTC](https://techcommunity.softwareag.com/t/how-to-call-java-from-natural-and-vice-versa-without-using-any-middleware-integration-layer/296867/18 "2025-10-21T10:14:29Z")

</div>

with DOM elements maybe we can do it?

---

<div class="post-metadata">

**Author:** ![Hritik\_Roshan](https://sea1.discourse-cdn.com/techcommunity/user_avatar/techcommunity.softwareag.com/hritik_roshan/32/39209_2.png) [@Hritik\_Roshan](https://techcommunity.softwareag.com/u/Hritik_Roshan)\
**Post date:** [October 22, 2025, 6:57pm UTC](https://techcommunity.softwareag.com/t/how-to-call-java-from-natural-and-vice-versa-without-using-any-middleware-integration-layer/296867/19 "2025-10-22T18:57:15Z")

</div>

> [@Mukunthan\_Sundararajan2](#):
>
> I am creating new Java functionality which will run on Mainframe ZOS. (Now we can run Java on IBM Mainframe.) we are a big Natural Adabas shop - just wondering when my natural and Java applications will run on the mainframe - do I need to have any middleware to communicate between Java and natural and vice versa? when I checked the documentation it says from natural to call Java we can use JNI - but we need to create some “C” wrapper to access Java. Java to Natural - Via Entire X. These are all very old posts.
> 
> Is there any update in the Natural / Adabas products where we can access Java which is running on the mainframe?
> 
> Can someone help with the steps to implement - Call Java directly from Natural and vice versa without any middle/ware and any C wrapper.
> 
> Thanks in advance - hoping will get a positive response

> [@Douglas\_Kelly](#):
>
> This appears to be nearly the same topic as raised by “ak\_kannan Kannan\_Alagarsamy” - perhaps you could review that discussion.
> 
> As there is no direct “call” function between Java and Natural (as Eugene has explained), a middleware of some sort is needed, whether it is passing sequential files back and forth or using a messaging tool like EntireX.
> 
> EntireX can either use web services or Java / Natural Wrappers to call to/from Java and Natural. Wrappers allow each tool to use it’s own native objects to communicate with the other platform. Web app store from bit.ly/42hbEfT services have a bit more overhead, but allow more portability - Java calling Natural RPC services exposed as EntireX web services does not need an EntireX runtime, but the Wrappers approach will need an EntireX runtime available.

> [@Neil\_Beesley9](#):
>
> Douglas,  
> Purely by coincidence I have been working on calling Java from ASM/COBOL/higher level languages (e.g. NATURAL) as part of an open mainframe project. I had to provide the following key functionality (not an exhaustive list) to call Java from ASM/COBOL/etc within the same address space:
> 
> 1. Simple calling API to send/receive data between ASM/COBOL/etc. and Java
> 2. Being able to dynamically load Java classes and call the method specified in the API
> 3. Start the JVM once and only once within the job step of the JCL
> 4. Capability to work with multi-threaded ASM/COBOL/etc. applications efficiently  
> Since it’s an ongoing open mainframe project it may be of some use to someone.  
> Neil.

> [@Hritik\_Roshan](#):
>
> with DOM elements maybe we can do it?

hope my answer helps and if im wrong, correct me

---

<div class="post-metadata">

**Author:** ![Neil\_Beesley9](https://sea1.discourse-cdn.com/techcommunity/user_avatar/techcommunity.softwareag.com/neil_beesley9/32/37232_2.png) [@Neil\_Beesley9](https://techcommunity.softwareag.com/u/Neil_Beesley9)\
**Post date:** [October 27, 2025, 9:32pm UTC](https://techcommunity.softwareag.com/t/how-to-call-java-from-natural-and-vice-versa-without-using-any-middleware-integration-layer/296867/20 "2025-10-27T21:32:28Z")

</div>

Call interface:

CALL ‘GVBUR70’ #UR70-PARAMETER-AREA  
#UR70-A10-SEND-AREA  
#UR70-A22-RECV-AREA  
#UR70-MSGTXT

1 #UR70-PARAMETER-AREA (B112)  
1 REDEFINE #UR70-PARAMETER-AREA  
2 #UR70-VERSION (I2)  
2 #UR70-FLAG1 (B1)  
2 #UR70-FLAG2 (B1)  
2 #UR70-FUNCTION (A8)  
2 #UR70-OPTIONS (A8)  
2 REDEFINE #UR70-OPTIONS  
3 #UR70-OPTION1 (I2)  
3 #UR70-SPARE (B6)  
2 #UR70-CLASS (A32)  
2 #UR70-METHOD (A32)  
2 #UR70-LEN-SEND (I4)  
2 #UR70-LEN-RECV (I4)  
2 #UR70-LEN-RETN (I4)  
2 #UR70-RETC (I4)  
2 #UR70-ANCHOR (B4)  
2 #UR70-JRETC (I4)  
2 #UR70-LREQD (I4)

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/techcommunity/original/3X/c/d/cd19967bb605d28a72d77eb83a1cae22f3df2eb8.svg) [@system](https://techcommunity.softwareag.com/u/system)\
**Post date:** [April 25, 2026, 9:32pm UTC](https://techcommunity.softwareag.com/t/how-to-call-java-from-natural-and-vice-versa-without-using-any-middleware-integration-layer/296867/21 "2026-04-25T21:32:34Z")

</div>

Closed on April 25, 2026, 9:32pm UTC

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.
