# OPTIONAL Parameter Data Area

**URL:** <https://techcommunity.softwareag.com/t/optional-parameter-data-area/182990>\
**Category:** Forum\
**Tags:** Adabas-Natural, Natural, Natural-on-Mainframes\
**Created:** [July 24, 2015, 12:21pm UTC](https://techcommunity.softwareag.com/t/optional-parameter-data-area/182990 "2015-07-24T12:21:23Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rebecca\_Rose\_Flores1](https://avatars.discourse-cdn.com/v4/letter/r/22d042/32.png) [@Rebecca\_Rose\_Flores1](https://techcommunity.softwareag.com/u/Rebecca_Rose_Flores1)\
**Post date:** [July 24, 2015, 12:21pm UTC](https://techcommunity.softwareag.com/t/optional-parameter-data-area/182990/1 "2015-07-24T12:21:23Z")

</div>

How does one make a whole PDA OPTIONAL?

```auto
PARAMETER USING 'PARATEST' OPTIONAL
```

The code above doesn’t work.  
And how would I code the corresponding IS SPECIFIED condition?

Note that the PDA is coded as follows:

```auto
01 PARAMETERS (1:*)
02 PARA1 (A5)
02 PARA2 (N7)
02 PARA3 (N7)
```

---

<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:** [July 24, 2015, 12:50pm UTC](https://techcommunity.softwareag.com/t/optional-parameter-data-area/182990/2 "2015-07-24T12:50:37Z")

</div>

You can only make individual parameters optional, but not the entire data area.

---

<div class="post-metadata">

**Author:** ![Rebecca\_Rose\_Flores1](https://avatars.discourse-cdn.com/v4/letter/r/22d042/32.png) [@Rebecca\_Rose\_Flores1](https://techcommunity.softwareag.com/u/Rebecca_Rose_Flores1)\
**Post date:** [July 24, 2015, 12:55pm UTC](https://techcommunity.softwareag.com/t/optional-parameter-data-area/182990/3 "2015-07-24T12:55:42Z")

</div>

Well, that may be a problem. Thanks, Wolfgang.

---

<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:** [July 28, 2015, 11:43pm UTC](https://techcommunity.softwareag.com/t/optional-parameter-data-area/182990/4 "2015-07-28T23:43:47Z")

</div>

Regarding the SPECIFIED keyword, examples may be found in library SYSEXPG in FNAT. Here is a listing of FUNCEX02:

```auto
DEFINE FUNCTION F#ADDITION
  RETURNS (I2)
  DEFINE DATA PARAMETER
    1 #PARM1 (I2) OPTIONAL
    1 #PARM2 (I2) OPTIONAL
    1 #PARM3 (I2) OPTIONAL
  END-DEFINE
  /*
  RESET F#ADDITION
  IF #PARM1 SPECIFIED
    F#ADDITION := F#ADDITION + #PARM1
  END-IF
  IF #PARM2 SPECIFIED
    F#ADDITION := F#ADDITION + #PARM2
  END-IF
  IF #PARM3 SPECIFIED
    F#ADDITION := F#ADDITION + #PARM3
  END-IF
  /*
END-FUNCTION
*
END
```

---

<div class="post-metadata">

**Author:** ![Steve\_Robinson](https://sea1.discourse-cdn.com/techcommunity/user_avatar/techcommunity.softwareag.com/steve_robinson/32/107_2.png) [@Steve\_Robinson](https://techcommunity.softwareag.com/u/Steve_Robinson)\
**Post date:** [July 30, 2015, 1:37pm UTC](https://techcommunity.softwareag.com/t/optional-parameter-data-area/182990/5 "2015-07-30T13:37:54Z")

</div>

It is not clear from your question what you are trying to accomplish.

I am guessing that you might have an existing PDA and probably have many objects that call a subprogram that uses the pda. You want to know if a calling object does or does not pass arguments. If this is a correct interpretation, you might employ code like the following

define data parameter  
1 #a (a35) optional  
1 redefine #a  
2 #b (a10)  
2 #c (n15)  
2 #d (a10)  
end-define  
\*  
if #a specified  
::::  
end

This would only require adding a first field to the pda which encompasses all your current fields.

---

<div class="post-metadata">

**Author:** ![Rebecca\_Rose\_Flores1](https://avatars.discourse-cdn.com/v4/letter/r/22d042/32.png) [@Rebecca\_Rose\_Flores1](https://techcommunity.softwareag.com/u/Rebecca_Rose_Flores1)\
**Post date:** [July 30, 2015, 1:56pm UTC](https://techcommunity.softwareag.com/t/optional-parameter-data-area/182990/6 "2015-07-30T13:56:09Z")

</div>

Hi Steve. Yes, we had to do away with the whole PDA and use OPTIONAL only on individual parameters.

We merely wanted to know if a whole PDA could be optional, which Wolfgang kindly answered.

Thanks.

---

<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:33pm UTC](https://techcommunity.softwareag.com/t/optional-parameter-data-area/182990/7 "2021-04-02T15:33:51Z")

</div>


