# Multiple PDAs with variable Arrays

**URL:** <https://techcommunity.softwareag.com/t/multiple-pdas-with-variable-arrays/311547>\
**Category:** Forum\
**Tags:** Adabas-Natural, Natural, Natural-on-Mainframes, NaturalONE\
**Created:** [October 1, 2025, 8:47am UTC](https://techcommunity.softwareag.com/t/multiple-pdas-with-variable-arrays/311547 "2025-10-01T08:47:10Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![myuser](https://avatars.discourse-cdn.com/v4/letter/m/c68b51/32.png) [@myuser](https://techcommunity.softwareag.com/u/myuser)\
**Post date:** [October 1, 2025, 8:47am UTC](https://techcommunity.softwareag.com/t/multiple-pdas-with-variable-arrays/311547/1 "2025-10-01T08:47:10Z")

</div>

I have multiple PDAs for different subprograms, which I want to call from a single other subprogram.  
Each PDA has an array defined as:

01 MYPDA  
02 FILTER-ARRAY (A3/1:V)

Now when using such a PDA as a local data area, the following line has to be declared, with a value of the devs choosing (as per Natural For Mainframes 8.2.7, Array Dimension Definition → very bottom of page):

01 V (N3) CONSTANT \<100\>  
LOCAL USING MYPDA

Now if I have multiple PDAs, each with such a variable array, declared as LDAs in another subprogram, I am bound to **one** declaration of V as a constant, meaning all variable arrays from the PDAs will have the same length of V.

Is it possible to circumvent this?

Essentially, what I’m trying to do is to enable callers of my subprogram to enter a number of filters of their choosing into my array, without much overhead.

---

<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:** [October 1, 2025, 4:21pm UTC](https://techcommunity.softwareag.com/t/multiple-pdas-with-variable-arrays/311547/2 "2025-10-01T16:21:09Z")

</div>

A link to the doc you are mentioning would be more helpful to follow what you are looking at.

This is from the v92 docs, but I don’t think much has changed in the X-Arrays since V82 - [X-Arrays](https://documentation.softwareag.com/natmf/9.2.3/en/webhelp/natmf-webhelp/pg/pg_defi_xarry.htm#def)

You do not have to use constants to reference/define dynamic arrays. You do have to materialize the array using the EXPAND/RESIZE statements. In your case the calling module (program, subprogram, etc) needs to size the array as needed and pass the array to the called subprogram:

ASSIGN #N = 100

EXPAND FILTER-ARRAY TO (1:#N)

CALLNAT ‘SUB’ FILTER-ARRAY(\*)

A constant for #N can be used, but the called subprogram can resize the array as needed. You can see the current bounds of the array with the \*LBOUND / \*UBOUND system variables - e.g \*UBOUND(FILTER-ARRAY) will tell you the size of your array (if your lower bound is 1) or use \*OCCURRENCE(FILTER-ARRAY) to see the count of occurrences.

---

<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:** [October 2, 2025, 1:52pm UTC](https://techcommunity.softwareag.com/t/multiple-pdas-with-variable-arrays/311547/3 "2025-10-02T13:52:59Z")

</div>

Yes, only one PDA can use the in-stream definition of variable V. The other PDAs must be included in your program as LDAs or in-stream structures, with their own dimension variables. In my example, the second structure is in-stream and the third has been defined in an LDA, with dimensions #V2 and #V3, repectively.

```auto
DEFINE DATA
LOCAL
1 V (I4) CONST <10>
1 #V2 (I4) CONST <20>
LOCAL USING V-PDAA1 /* #TBL1
LOCAL
1 #TBL2 /* #TBL2
  2 #VAR (A3/1:#V2)
LOCAL USING V-PDAL3 /* #TBL3 30 occ
END-DEFINE
CALLNAT "V-PDAN" #TBL1
CALLNAT "V-PDAN" #TBL2
CALLNAT "V-PDAN" #TBL3.#VAR (1:5)
END

```

Local V-PDAA1

```auto
DEFINE DATA PARAMETER
 1 #TBL1
   2 #VAR (A3/1:V)
END-DEFINE

```

Local V-PDAL3

```auto
DEFINE DATA LOCAL
 1 #V3 (I4) CONST <30>
 1 #TBL3
   2 #VAR (A3/1:#V3)
END-DEFINE

```

Subprogram V-PDAN

```auto
DEFINE DATA
PARAMETER USING V-PDAA1
END-DEFINE
WRITE *PROGRAM
      'occurrences:' *OCC (#VAR)
END

```

Program output

```auto
Page 1 25-10-02 08:48:01
 
V-PDAN occurrences: 10
V-PDAN occurrences: 20
V-PDAN occurrences: 5

```

---

<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:** [March 31, 2026, 1:53pm UTC](https://techcommunity.softwareag.com/t/multiple-pdas-with-variable-arrays/311547/4 "2026-03-31T13:53:09Z")

</div>

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