# Calling subprogram recursively with Java wrapper

**URL:** <https://techcommunity.softwareag.com/t/calling-subprogram-recursively-with-java-wrapper/59109>\
**Category:** Forum\
**Tags:** Mainframe-Integration, EntireX\
**Created:** [March 11, 2005, 9:06pm UTC](https://techcommunity.softwareag.com/t/calling-subprogram-recursively-with-java-wrapper/59109 "2005-03-11T21:06:27Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![David\_Melby](https://avatars.discourse-cdn.com/v4/letter/d/8797f3/32.png) [@David\_Melby](https://techcommunity.softwareag.com/u/David_Melby)\
**Post date:** [March 11, 2005, 9:06pm UTC](https://techcommunity.softwareag.com/t/calling-subprogram-recursively-with-java-wrapper/59109/1 "2005-03-11T21:06:27Z")

</div>

I’m calling a Natural subprogram using the Java wrapper. The Natural program is setup to send 24 records at a time. Since my Java program needs to retrieve more than 24 records, I need to call the program recursively until I get all of the data. It works fine when I call the routine from the workbench using the “Generate and run test” option. When I try calling it recursively from my Java program, it receives only the first 24 every time. Is there a simple way or example to demonstrate how this can be accomplished?

---

<div class="post-metadata">

**Author:** ![Guest](https://sea1.discourse-cdn.com/techcommunity/user_avatar/techcommunity.softwareag.com/guest/32/75_2.png) [@Guest](https://techcommunity.softwareag.com/u/Guest)\
**Post date:** [March 11, 2005, 10:57pm UTC](https://techcommunity.softwareag.com/t/calling-subprogram-recursively-with-java-wrapper/59109/2 "2005-03-11T22:57:13Z")

</div>

You have two options to address this issue:  
1) You can make use of conversational RPC in order to return the complete result set to the Java client program. For more information on how to do this, please refer to the EntireX documentation. Start with the following section:  
c:/Program%20Files/Software%20AG/EntireX/Docu/devkit/rpc\_java/advanced.htm#Using\_Conversational\_RPC  
  
2) Your second option is to include an additional parameter, which would be your restart value. Your subprogram can populate this parameter with the next record to be returned. You Java client will then make sure that this restart value is sent to the Natural subprogram when you do the next call and the next set of records will be returned to you.  
  
Regards  
Theo

---

<div class="post-metadata">

**Author:** ![David\_Melby](https://avatars.discourse-cdn.com/v4/letter/d/8797f3/32.png) [@David\_Melby](https://techcommunity.softwareag.com/u/David_Melby)\
**Post date:** [March 17, 2005, 12:51am UTC](https://techcommunity.softwareag.com/t/calling-subprogram-recursively-with-java-wrapper/59109/3 "2005-03-17T00:51:18Z")

</div>

Where can I find some more documentation/examples on what you have suggested?

---

<div class="post-metadata">

**Author:** ![Guest](https://sea1.discourse-cdn.com/techcommunity/user_avatar/techcommunity.softwareag.com/guest/32/75_2.png) [@Guest](https://techcommunity.softwareag.com/u/Guest)\
**Post date:** [March 19, 2005, 1:12am UTC](https://techcommunity.softwareag.com/t/calling-subprogram-recursively-with-java-wrapper/59109/4 "2005-03-19T01:12:14Z")

</div>

You can view the documentation:  
file:///c:/Program%20Files/Software%20AG/EntireX/Docu/devkit/rpc\_java/advanced.htm#Using\_Conversational\_RPC

Unfortunately I don’t have a conversational RPC example. I’ll see whether I can find one for you.

Regards  
Theo

---

<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 2, 2021, 2:39pm UTC](https://techcommunity.softwareag.com/t/calling-subprogram-recursively-with-java-wrapper/59109/5 "2021-04-02T14:39:39Z")

</div>


