# Passing excel data to Natural

**URL:** <https://techcommunity.softwareag.com/t/passing-excel-data-to-natural/200589>\
**Category:** Forum\
**Tags:** Adabas-Natural, Natural, Natural-Remote-Procedure-Call-RPC, Natural-on-Windows-Unix\
**Created:** [August 22, 2018, 9:04pm UTC](https://techcommunity.softwareag.com/t/passing-excel-data-to-natural/200589 "2018-08-22T21:04:00Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kenneth\_Ryan](https://avatars.discourse-cdn.com/v4/letter/k/71c47a/32.png) [@Kenneth\_Ryan](https://techcommunity.softwareag.com/u/Kenneth_Ryan)\
**Post date:** [August 22, 2018, 9:04pm UTC](https://techcommunity.softwareag.com/t/passing-excel-data-to-natural/200589/1 "2018-08-22T21:04:00Z")

</div>

I’m prototyping calling Natural from Microsoft Excel using EntireX and had a question. I have defined my PDA as follows and plan on passing (and returning) csv rows with a maximum length of 229…

DEFINE DATA  
PARAMETER  
1 #IN (A229/1:V) /\* INOUT  
\*

My extracted IDL looks like…  
…  
define data parameter  
1 #IN (A229/1:V) In Out /\* Restricted usage: (A229/1:V) : Natural V-array is not a full IDL unbounded array /\* INOUT  
\*…

Can someone explain to me the “Restricted usage” warning message before I get too far down this path? Thanks

Ken

---

<div class="post-metadata">

**Author:** ![Kenneth\_Ryan](https://avatars.discourse-cdn.com/v4/letter/k/71c47a/32.png) [@Kenneth\_Ryan](https://techcommunity.softwareag.com/u/Kenneth_Ryan)\
**Post date:** [August 22, 2018, 9:42pm UTC](https://techcommunity.softwareag.com/t/passing-excel-data-to-natural/200589/2 "2018-08-22T21:42:17Z")

</div>

Or maybe there’s a better format to pass table data to a sub program?

---

<div class="post-metadata">

**Author:** ![Ralph\_Zbrog](https://sea1.discourse-cdn.com/techcommunity/user_avatar/techcommunity.softwareag.com/ralph_zbrog/32/78_2.png) [@Ralph\_Zbrog](https://techcommunity.softwareag.com/u/Ralph_Zbrog)\
**Post date:** [August 22, 2018, 11:43pm UTC](https://techcommunity.softwareag.com/t/passing-excel-data-to-natural/200589/3 "2018-08-22T23:43:10Z")

</div>

Have you considered the alternatives?

Mainframe:

- To Excel:  
Create a TAB-delimited (pseudo-CSV format) record.

```auto
COMPRESS NUMERIC field-list INTO #large-variable WITH ALL DELIMITER H'09' 
WRITE WORK nn #large-variable
```

- From Excel:  
Use Save as in Excel to create a CSV-format file. Read the WORK file and SEPARATE the columns.

Natural for Windows:

- To Excel:  
Create a CSV-format file.

```auto
DEFINE WORK FILE nn TYPE "CSV"
WRITE WORK nn field-list
```

- From Excel:  
Use Save as in Excel to create a CSV-format file that Natural can read natively.

```auto
DEFINE WORK FILE nn TYPE "CSV"
READ WORK nn field-list
```

- Read and write Excel files:  
Create a Natural Dialog to create, access, and update Excel files. Dialogs have full access to ActiveX controls and Excel methods.

---

<div class="post-metadata">

**Author:** ![Kenneth\_Ryan](https://avatars.discourse-cdn.com/v4/letter/k/71c47a/32.png) [@Kenneth\_Ryan](https://techcommunity.softwareag.com/u/Kenneth_Ryan)\
**Post date:** [August 23, 2018, 1:03am UTC](https://techcommunity.softwareag.com/t/passing-excel-data-to-natural/200589/4 "2018-08-23T01:03:59Z")

</div>

I believe your solution requires a Natural license for Windows which I do not have. Also, I wanted to write an Excel add in and call Natural from within Excel so the user would never have to exit Excel to do the processing.

Ken

---

<div class="post-metadata">

**Author:** ![Ralph\_Zbrog](https://sea1.discourse-cdn.com/techcommunity/user_avatar/techcommunity.softwareag.com/ralph_zbrog/32/78_2.png) [@Ralph\_Zbrog](https://techcommunity.softwareag.com/u/Ralph_Zbrog)\
**Post date:** [August 23, 2018, 1:06am UTC](https://techcommunity.softwareag.com/t/passing-excel-data-to-natural/200589/5 "2018-08-23T01:06:00Z")

</div>

If Natural is being used solely to retrieve Adabas data, then Adabas SOA Gateway can retrieve that data from within Excel.

---

<div class="post-metadata">

**Author:** ![Kenneth\_Ryan](https://avatars.discourse-cdn.com/v4/letter/k/71c47a/32.png) [@Kenneth\_Ryan](https://techcommunity.softwareag.com/u/Kenneth_Ryan)\
**Post date:** [August 23, 2018, 1:26am UTC](https://techcommunity.softwareag.com/t/passing-excel-data-to-natural/200589/6 "2018-08-23T01:26:20Z")

</div>

There’s quite a bit of processing being done to the data in the Natural program, so the Adabas Gateway is an interesting idea but not an option for this task.

---

<div class="post-metadata">

**Author:** ![Rolf\_Bahlke](https://sea1.discourse-cdn.com/techcommunity/user_avatar/techcommunity.softwareag.com/rolf_bahlke/32/109_2.png) [@Rolf\_Bahlke](https://techcommunity.softwareag.com/u/Rolf_Bahlke)\
**Post date:** [August 23, 2018, 9:39am UTC](https://techcommunity.softwareag.com/t/passing-excel-data-to-natural/200589/7 "2018-08-23T09:39:03Z")

</div>

> [@Kenneth Ryan](#):
>
> My extracted IDL looks like…  
> …  
> define data parameter  
> 1 #IN (A229/1:V) In Out /\* Restricted usage: (A229/1:V) : Natural V-array is not a full IDL unbounded array /\* INOUT  
> \*…
> 
> Can someone explain to me the “Restricted usage” warning message before I get too far down this path? Thanks

Hi Ken,  
you should use Natural X-Arrays, see [https://techcommunity.softwareag.com/ecosystem/documentation/natural/nat827mf/rpc/limits.htm#limits\_x\_arrays](https://techcommunity.softwareag.com/ecosystem/documentation/natural/nat827mf/rpc/limits.htm#limits_x_arrays)

---

<div class="post-metadata">

**Author:** ![Kenneth\_Ryan](https://avatars.discourse-cdn.com/v4/letter/k/71c47a/32.png) [@Kenneth\_Ryan](https://techcommunity.softwareag.com/u/Kenneth_Ryan)\
**Post date:** [August 23, 2018, 5:22pm UTC](https://techcommunity.softwareag.com/t/passing-excel-data-to-natural/200589/8 "2018-08-23T17:22:41Z")

</div>

Rolf,

Thank you for your suggestion, IDL looks cleaner now…

define data parameter  
1 #PARM (A6) In /\* IN  
1 #IN (A229/1:V) In /\* Full usage: (A229/1:_) : Originates from Natural X-array /_ IN  
1 #OUT (A229/1:V) Out /\* Full usage: (A229/1:_) : Originates from Natural X-array /_ OUT  
\*

Ken

---

<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:** [August 24, 2018, 2:21am UTC](https://techcommunity.softwareag.com/t/passing-excel-data-to-natural/200589/9 "2018-08-24T02:21:20Z")

</div>

a suggestion: if your Natural subprograms are operating on specific data (which the length of A229 suggests), you can generate the actual columns of data to send than having to create csv from Excel columns and parse the csv in Natural. You can still use the x-array to handle variable number of rows.

---

<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, 3:41pm UTC](https://techcommunity.softwareag.com/t/passing-excel-data-to-natural/200589/10 "2021-04-02T15:41:16Z")

</div>


